element.remove won't work
- Linguagem predominante
- JavaScript
- Estrelas
- 11.3k
- Forks
- 3k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.