typescript - Angular 2 re-Resolving data upon query parameter change? -
in angular 2 project, wasn't able reload page navigating same url different query params. using resolve pre-fetch data upon loading page.
i trying resolver re-fetch data when there's url (query param) change. how do ?
i think can't changed queryparam. don't know if helps here answer.
construtor(private route: activatedroute) { } ngoninit() { this.route.snapshot.queryparams['something'];//when snapshot , navigate same url can't new query params, first initialization // new queryparams or url params need subscribe (for same url navigation) this.route.queryparams.subscribe({ (queryparams: params) => { this.yourparam = queryparams['something']; } }) }
i think using snapshot instead of observable queryparams thats why.
Comments
Post a Comment