working with a simple app in angular5 , i have a header containing 'profil' link , i'm trying to redirect the user to the profilComponent when clicking on the link but nothing happends , instead of that the user get logged out of the app .
i'm Using jwt for authentication .
This is how the structure of the project looks like :
for profil components it exists inside views directory :
i have already added ProfilRoutingModule in the profil module , and also i have added profil module in app.routing.ts :
{
path: 'profil',
loadChildren: './views/profil/profil.module#ProfilModule'
},
do i miss something ? Why i cant be redirected to profil and getting logged out of the app instead? Any idea?
Why use href? Angular has routerlink. Use it like this.
routerLink="/profile"
您需要设置routerLink
而不是href
<li><a [routerLink]="['/profil']">Profil</a></li>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.