element.remove won't work
- Langage dominant
- JavaScript
- Étoiles
- 11.3k
- Forks
- 3k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
I'm trying to deploy a directive that removes an element if the role is not specified
```
angular.module("BlurAdmin")
.directive('restrict',restrict);
function restrict (authService, $http, $state){
return{
restrict: 'A',
prioriry: 100000,
scope: false,
link: function(){
},
compile: function(element, attr, linker){
var accessDenied = true;
var attributes = attr.access.split(" ");
var getCurrentUser = function () {
authService.getCurrentUser()
.success(function (data) {
var user = data;
for(var i in attributes){
if(user.roles[0].name == attributes[i]){
accessDenied = false;
}
};
if(accessDenied){
element.children().remove();
element.remove();
};
})
.error(function (data, status) {
$state.go("/login");
});
};
getCurrentUser();
}
}
}
```
I call it this way :
``
but the element doesn't get removed.
and I've checked the I can pass the if satatement
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.