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

Cannot read property 'split' of undefined at aclShowWatchAction #29

Open
roselleebarle04 opened this issue Jul 10, 2017 · 7 comments
Open

Comments

@roselleebarle04
Copy link

In watching attrs.aclShow, we should check if value is not null

screen shot 2017-07-11 at 6 54 20 am

@luciano-work
Copy link

luciano-work commented Jul 20, 2017

Hi @roselleebarle04
I change the code in angular-acl.js for this and fix my problem ;)
I hope this resolve your problem

.directive('aclShow', function (AclService) {
  return {
    restrict: 'A',
    link: function (scope, element, attrs) {
      scope.$watch(attrs.aclShow, function aclShowWatchAction(value) {
        var permissions, can;
        permissions = attrs.aclShow;
        can = AclService.can(permissions);
        if (!can) {
          element.addClass(NG_HIDE_CLASS);
        } else {
          element.removeClass(NG_HIDE_CLASS);
        }
      });
    }
  };
});

@mikemclin
Copy link
Owner

@roselleebarle04 I am making it so null values cause the element not to show.

@mikemclin
Copy link
Owner

This fix is in the 0.1.10 release

@luciano-work
Copy link

Hi @mikemclin,
I think this dont fix the problem =[

image

@mikemclin
Copy link
Owner

@luciano-work does this work for you?

.directive('aclShow', function (AclService) {
  return {
    restrict: 'A',
    link: function (scope, element, attrs) {
      attrs.$observe('aclShow', function aclShowWatchAction(value) {
        var permissions, can;
        if (!value) {
          element.addClass(NG_HIDE_CLASS);
          return;
        }
        permissions = value.split(',');
        can = AclService.canAny(permissions);
        if (!can) {
          element.addClass(NG_HIDE_CLASS);
        } else {
          element.removeClass(NG_HIDE_CLASS);
        }
      });
    }
  };
});

@mikemclin mikemclin reopened this Jul 21, 2017
@luciano-work
Copy link

Doesn't work for me =(
I have received an error in this code line:
permissions = value.split(',');

@ivanvastag
Copy link

Hi, we are having the same issue with this. Still not getting any values from value attribute.

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

4 participants