Enable / Disable angular buttons with values from api

0

I have my following screen:

The side menu comes from an api List with user permissions

I have my classes:

public class Menu {

    public int Id {get;set;}
    public string Nome {get;set;}
}
public class Item {
    public int Id {get;set;}
    public string Nome {get;set;}
    public Menu Menu {get;set;}
}
public class Opcao {
    public int {get;set;}
    public string Nome {get;set;}
    public Item Item {get;set;}
}

Where Menu = Registration

Item = Customer

Option = Include, Edit, Delete, Other ...

The side menu listing I got perfectly, just use ng-repeat and that's it.

My problem is the Option, how do I play the correct one for that view? to enable / disable the buttons that it has or not permission?

    
asked by anonymous 08.08.2014 / 16:32

1 answer

1

As AngularJS does not work with access / permission control, I'd use ng-show / ng-hide depending on how your API data structure comes in.

An example would be:

<tr>
   <td ng-show="user.hasPermitionToEdit">Editar</td>
   <td ng-show="user.hasPermitionToDelete">Excluir</td>
</tr>

I hope I have helped you.

    
08.08.2014 / 17:35