angular2-router3

How to route to a Module as a child of a Module - Angular 2 RC 5

好久不见. 提交于 2019-11-27 17:04:48
I am in the process upgrading an application I'm working on to the latest Angular 2 release candidate. As part of this work I am attempting to use the NgModule spec and migrating all of the parts of my application to modules. For the most part, this has gone very well with the exception of an issue with routing. "@angular/common": "2.0.0-rc.5", "@angular/compiler": "2.0.0-rc.5", "@angular/core": "2.0.0-rc.5", "@angular/forms": "0.3.0", "@angular/http": "2.0.0-rc.5", "@angular/platform-browser": "2.0.0-rc.5", "@angular/platform-browser-dynamic": "2.0.0-rc.5", "@angular/router": "3.0.0-rc.1", My

Want to prevent Component recreation while routing in Angular 2

夙愿已清 提交于 2019-11-27 14:06:50
Let's say we have two routes Dashboard and Profile . Dashboard has dynamic tabs feature like Google spreadsheet . I want to do some interactions(build charts, visualizing some data) creating tabs in the Dashboard . Now, if I route to Profile and then route back to Dashboard , I want to see what was before in those tabs in Dashboard . It means, I want to maintain the state in the client side. AFAIK while routing between components, it recreates components. Is it possible to make spreadsheet like application while using angular 2 routing? I need to use routing because in my application I have to

Can't reload/refresh active route

五迷三道 提交于 2019-11-27 04:36:25
I have recently updated to the new RC3 and Router3alpha and it seems some things have changed. I noticed that a click on the link of an active route does no longer result in the component to be reloaded. How do I achieve this behaviour with the new router3? My link looks like <a [routerLink]="['/link1']">Link1</a> And to test I simply used a random number in ngOnInit: export class LinkoneComponent implements OnInit { public foo: number; constructor() {} ngOnInit() { this.foo = Math.floor(Math.random() * 100) + 1; } } It works just fine when switiching between routes, but a click on the

Do I have to unsubscribe from ActivatedRoute (e.g. params) observables?

二次信任 提交于 2019-11-27 02:07:01
问题 I find many examples where ActivatedRoute Observables like params or url are subscribed but not unsubscribed. constructor(private route: ActivatedRoute) {} ngOnInit() { this.route.params // (+) converts string 'id' to a number .switchMap((params: Params) => this.service.getHero(+params['id'])) .subscribe((hero: Hero) => this.hero = hero); } Are the route objects and subscriptions destroyed automagically and newly created for every component creation? Do I have to care about unsubscribing from

How to route to a Module as a child of a Module - Angular 2 RC 5

一个人想着一个人 提交于 2019-11-26 18:53:52
问题 I am in the process upgrading an application I'm working on to the latest Angular 2 release candidate. As part of this work I am attempting to use the NgModule spec and migrating all of the parts of my application to modules. For the most part, this has gone very well with the exception of an issue with routing. "@angular/common": "2.0.0-rc.5", "@angular/compiler": "2.0.0-rc.5", "@angular/core": "2.0.0-rc.5", "@angular/forms": "0.3.0", "@angular/http": "2.0.0-rc.5", "@angular/platform-browser