Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
myke11j opened this issue Jan 20, 2018 · 1 comment
Open

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

myke11j opened this issue Jan 20, 2018 · 1 comment

Comments

@myke11j
Copy link

myke11j commented Jan 20, 2018

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.

@daoudaDiallo
Copy link
Owner

Hi @myke11j , please reinstall ng2-acl and try again. Normally problem is fixed.
Thanks for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants