I have created one router link as below. This router link loads ProductsStartComponent
and then this component loads several other components using ngif and not via navigation. Since below Product categories link is visible in all pages so if I am clicking on this link after reaching to some component of ngif , this is not taking me back on ProductsStartComponent
.
As I am new to Angular , my understanding for this behavior is because all values/models are set and that's why it's not navigating. I suppose this can be achieved by refresh or reload of page but how to achieve that. Please advise.
In admin.component.html, router Link is defined for clicking.
returns
<li routerLinkActive="active"><a routerLink="categories"><p>Products Categories</p></a></li>
returns
In app-routing.module.ts, which component need to be loaded on clicking of router link
const appRoutes: Routes = [
{path: 'admin', component: AdminComponent, children: [
{ path: 'dashboard', component: AdminDashboardComponent },
{ path: 'sellers', component: AdminSellersComponent },
{ path: 'categories', component: ProductsStartComponent}
]}]
In product-start.component.html, this is being loaded on first click on router link. Now if I click on edit button and moved to other component and again if i click on product categories router link , nothing happen , I am expecting it to reset the page.
<div>
<div *ngIf="!isChildProductClicked; else notClicked" >
<app-admin-products (productId)="received($event)"></app-admin-products>
</div>
<ng-template #notClicked><app-child-products [selProdIndex]=productIndex></app-child-products></ng-template>
</div>
question from:
https://stackoverflow.com/questions/45607077/how-to-refresh-page-in-angular-2 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…