akveo / akveo/blur-admin

element.remove won't work

Aberta
#237 0 comentários 0 reações 0 responsáveis Ver no GitHub
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.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.