angularjs - angular permission show message and set the button disabled -
i'm using "angular permission". validate user role , works perfect, want show message when user doesn't has these role , if possible shows button disabled. me this?
this router definition:
$stateprovider.state('actionaccess', {url: '/actionaccess', templateurl: 'views/actionaccess.html', controller: 'actionaccesscontroller', data: { permissions: { only: ['admin'] } } })
and function define if user has or not role:
.run(function (permission, authorizationfactory){ // define anonymous role permission.definerole('admin', function (stateparams) { return authorizationfactory.isinrole("admin"); }); })
according the documentation on project page, can specify in router config redirectto
property.
data: { permissions: { except: ['anonymous'], redirectto: 'login' } }
Comments
Post a Comment