Reputation: 65
I've installed the Angular CDK in order to use PrimeNG's dropdown component but it throws an error.
I've added this in my app.module.ts:
import {DropdownModule} from 'primeng/dropdown';
And installed the Angular CDK by simply typing in the following:
npm install @angular/cdk --save
Upvotes: 6
Views: 13536
Reputation: 1
export class authGuard implements CanActivate {
constructor(private jwtHelper: JwtHelperService){
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot){
const token: string | any = localStorage.getItem("accessToken");
const decodeToken = this.jwtHelper.decodeToken(token);
const expirationDate = this.jwtHelper.getTokenExpirationDate(token);
const expired: boolean | any = this.jwtHelper.isTokenExpired(token);
debugger;
return true;
}
}
I have this code for using authguard in angular.
@Injectable({ providedIn: 'root' })
When I add this code in up this page my problem is solved.
Upvotes: 0
Reputation: 488
In case someone has the same issue while trying to implement material design with angular material, rollback both material and cdk packages to an older version with:
npm i @angular/[email protected] @angular/[email protected] --save
I hope someone proposes a better approach that enables using the latest versions.
Upvotes: 3
Reputation: 150
I had the same issue. Check your cdk version in your package.json
I solved installing an older version of cdk 10:
npm i @angular/[email protected] --save
Upvotes: 8