i need determine route name url string.
this work router internally, because of {insert long story here} need manually. given piece of data api looks 'gallery/123' , need know route name 'gallery.post'. can route.replacewith(determinedroutename);
- need turn 'gallery/123' 'gallery.post'
- need turn 'stuff/99/comments' 'stuff.post.comments'
- etc
ember relies internally router-recognizer micro lib. think best option use well.
unfortunately, accessing router instance requiring rely on private -routing
service. (note: here pending rfc offering public router service).
injecting private service:
import ember 'ember'; export default ember.route.extend({ router: ember.inject.service('-routing'), ... });
the recognize
function returns list of handlers can join if want build complete string or else.
ex:
this.router.recognize("stuffs/99/comments"); > [{handler: "application", ...}, handler: "stuffs", ...}, handler: "stuff", ...}, handler: "comments", ...}, handler: "comments.index, ...}]
hope helps