can we view all the routes in emberjs aka something similar to what rake routes does in rails

℡╲_俬逩灬. 提交于 2019-11-30 07:04:38

Currently you can access all existing routes with App.Router.router.recognizer.names or just the names using Ember.keys(App.Router.router.recognizer.names).

It's obviously not as extensive as the Rails routes but it gives a quick and dirty overview.

In current versions of Ember/Ember-cli this is Object.keys(App.__container__.lookup('router:main').router.recognizer.names), where App is the name of your Ember app.

brendanwb

To piggy back off of Bradley Priest's answer, this may seem obvious to seasoned programmers, but for newb's, you can run App.Router.router.recognizer.names command in the debug console in the browser (ie: Firebug in Firefox, Chrome Developer Tools, etc...) after you load your Ember app in the browser.

Also note that App should be whatever you named your Ember App in the application.js file.

None of the previous answers work anymore. This works for ember 2.18.2:

App.__container__.lookup('router:main')._routerMicrolib.recognizer.names

(again, where App is the name of your ember app)

ember-cli: 2.18.2 node: 6.11.1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!