Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从控制器中知道Ember中当前路由的名称。搜索后我找到了这个主题和这个主题,但是对我来说是有用的。我this.routeName的this.get('currentPath')Ember 版本是1.1.2
this.routeName
this.get('currentPath')
1.1.2
我知道如何做到这一点的唯一方法是要求application这样的控制器。
application
App.AfterController = Ember.Controller.extend({ needs: ['application'], init: function() { alert('Current route is ' + this.get('controllers.application.currentPath')); this._super(); } });