This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<base href="/"> | |
</head> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { CanLoad } from '@angular/router'; | |
import { AuthService } from './auth.service'; | |
@Injectable() | |
export class AuthGuard implements CanLoad { | |
constructor( | |
private authService : AuthService | |
){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Injectable() | |
export class AuthGuard implements CanActivate { | |
constructor( | |
private authService : AuthService | |
){} | |
canActivate() { | |
if(this.authService.loggedIn) { | |
return this.authService.loggedIn; | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[routerLink] = "['/public', { id: 1 }]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this.router.navigate(['/public', { id: 1 }]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor( | |
private activeRoute : ActivatedRoute, | |
) { | |
activeRoute.params.subscribe(params => { | |
this.id = params['id']; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a [routerLink]=”[{ outlets: { namedOutlet: [‘routeName’] } }]”>Link</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<router-outlet></router-outlet> | |
<router-outlet name="named_outlet"></router-o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const appRoutes : Routes = [ | |
{ | |
path: '', | |
component : PublicComponent, | |
children: [ | |
{ | |
path: 'book-detail/:id', | |
component: BookDetailComponent | |
} | |
] |
NewerOlder