Skip to content Skip to sidebar Skip to footer

Update Template Using RouterLink In Angular2

I'm having problem with my template not being updated when I move to another store location. (e.g) Default is Eastleigh and if I move to USA it will change to USA but when I go to

Solution 1:

If those urls is used the same component. You can subscribe the url params change. e.g.

import { ActivatedRoute } from '@angular/router';

export class DemoPage {
    constructor(private _route: ActivatedRoute) { }
    ngOnInit() {
            this._route.params.forEach(params => {
                    let storeId= params["storeId"];
                    this.getStoreInfo(storeId);
            })
    }
} 

Post a Comment for "Update Template Using RouterLink In Angular2"