Migrating from the Ember.js app from JavaScript

How can I port an Ember.js application from a JavaScript function that is not part of Routeor Controller? Is it possible to call something like route.transitionTo()or controller.transitionToRoute()using an instance Ember.Applicationdirectly?

What I'm trying to do is integrate amMap into the Ember.js application, so when the area on the map is clicked , the application will go into the appropriate state.

Here is a jsFiddle example . When a continent is selected in the list, a continent is selected on the map. I want the opposite to also happen, which I should do in the following listeners:

map.addListener("homeButtonClicked", function () {
    // how can I transition to index from here?
    // similar to this.transitionTo("index") from a route or
    // this.transitionToRoute("index") from a controller
    alert("Transition to index");
});
map.addListener("clickMapObject", function (e) {
    // how can I transition to continent from here?
    // similar to this.transitionTo("continent", id) from a route or
    // this.transitionToRoute("continent", id) from a controller
    alert("Transition to continent: " + e.mapObject.id);
});
+4
source share
1

ah, , , "ember way":)

div "IndexView" didInsertElement(). emberjsbin: http://emberjs.jsbin.com/EsAkAVE/1/edit

+3

All Articles