angular - CanActivate is giving error after switching to r.c.3 -
i using canactivate in angular2 app this
@canactivate(() => isvaliduser())
it working fine until switched r.c.3 , started giving me error.
please suggest me recent changes regarding property.
you create auth.guard.ts in app folder:
app/auth.guard.ts:
import { canactivate } '@angular/router'; export class authguard implements canactivate { canactivate() { console.log('authguard#canactivate called'); return true; } }
then in routes.ts:
{ path: 'admin', component: yourcomponent, canactivate: [authguard] },
if don't have routes.ts, need create one, see reference here: https://angular.io/docs/ts/latest/guide/router.html
Comments
Post a Comment