如何在我的控制器中获取 App.Router 中的 rootURL 以在我的 JSON 请求中使用?
如果我指定这样的 rootURL:
App.Router.reopen({
rootURL: '/site1/'
});
我希望能够做这样的事情:
FooController = Ember.ObjectController.extend({
needs: ["application"],
actions: {
examine: function() {
var rootURL = this.get('controllers.application.router.rootURL');
$.getJSON(rootURL + "/examine/" + id).then(function(response) {
// do stuff with response
});
}
}
});