ember.js - what is the role of router in a single page application -


i new ember-js, going through blog entries , saw video of ember-js introduction tom dale.

to summarize router api newly introduced , best thing happened ember-js,router api used manage state of application , each state identified url, single page application in use 1 url, role of router, there 1 routeing entry mapped '/'(index)? if yes, lose advantage provided router api right?

now single page application in use 1 url, role of router, there 1 routeing entry mapped '/'(index)?

typically single page application still use url. example watch url change when using gmail. in case single page application means browser doesn't fetch new page url changes. gmail, typical ember single-page application change url user navigates various parts of application. ember router takes care of automatically.

if yes, lose advantage provided router api right?

if decide not use url, , want stay "/" whole time, can still use router. set router's location type "none"

see http://emberjs.com/guides/routing/specifying-the-location-api/

i understand routing here means managing states, @ point of time user can in set of states instance take gmail user in login state , compose state, how manages multiple states existing together?

for sure true. ember router statechart routes (leaf nodes) nested under number of resources. in case of gmail example logged in user can in compose state.

gmail url: https://mail.google.com/mail/u/0/?shva=1#inbox

// gmail routes: * /mail - mail application * /u/0 - connected account index 0 current user * ?shva=1 - http://stackoverflow.com/questions/1692968/what-is-shva-in-gmails-url * inbox - folder name 

embermail version: https://mail.ember.com/mail/u/0/inbox

// embermail routes this.resource('mail', { path: '/mail' }, function() {   this.resource('currentuser', { path: '/u' }, function() {     this.resource('account', { path: '/:account_id' }, function() {       this.route('folder', { path: '/:folder_id' });     });   }); }); 

can point me example application uses routing extensively?

the best example know of discourse. check out following example of how large ember application uses ember router:


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -