Router instantiates a new component every time navigating to a different 
component type. This has serious repercussions. Also, this is very 
different paradigm not only from previous versions of the router, but any 
routing framework. It actually appears to be a design defect.

Here is an example: A user may be in the middle of filling a long form on a 
tab1, he needs to lookup or verify some other details in tab2, when he 
comes back to tab1, everything is wiped out (as the component is 
re-instantiated). This implies that every time a user makes a change on a 
part of the UI, the state if the UI should be preserved (in anticipation of 
his unexpected navigation to another component, which co-exists on the same 
UI. The defacto method of developing a UI is to assume that the nodes of 
the component tree would only be changed when the developer explicitly 
replaces/ deletes them.

On a complex UI, say with graphics and multiple open tree controls 
(reflecting a user who is in middle of something), one would have to not 
only preserve content, but also unnecessarily preserve state of every bit 
of various widgets or graphics on the component. If the router had an 
option of reusing the components on the tree, (when navigating to a 
component of a different type from current component), one doesn't have to 
preserve the UI state. 

This idea of destroying the component every time (someone navigates to a 
different type of component) doesn't sound right from a performance point 
of view as well. the model from heavy backend call, would have to be cached 
or call repeated. 

This design makes the developer do a lot extra work (to preserve and 
recreate the work in progress - which we have never even cared about in the 
past) the and places performance penalty on the application. 

ng2router another third party routing library (has been around since 
angular1 days) doesn't mandate/ force the developer by recreating 
components. Any recommendations of if that is a better alternative than 
Router 3?
 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to