Skip to content

ERROR TypeError: Cannot read property 'roles' of undefined #1

@myke11j

Description

@myke11j

This is exactly like showed in docs, but it is keep giving the error in browser console.

<div class="mdl-layout__header-row">

        <!-- Add spacer, to align navigation to the right -->
        <div class="mdl-layout-spacer"></div>

        <!-- Navigation with router directives-->
        <nav class="mdl-navigation">
          <a class="mdl-navigation__link" [routerLink]="['/user-profile']">User Profile</a>
          <a class="mdl-navigation__link" [routerLink]="['/advance-user-profile']">Advance User Profile</a>
          <a *ngIf="can('admin')" class="mdl-navigation__link" [routerLink]="['/contact-user']">Contact User</a>
        </nav>
      </div>

This is the error

ERROR TypeError: Cannot read property 'roles' of undefined
    at AppComponent.AclService.can (index.js:181)

However, I have setup the permission for user and even logging this.aclService.getRoles() shows the correct user role. And after that is throws the above error.

Any help would be much appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions