1
I have a list of items, where it is possible to edit and delete them through a button, and we have access levels in that system, having 'Sellers' and 'Master Users', but sellers can not delete anything, only Masters, therefore, on the delete button, I put a 'disabled' so it gets disabled, and I want to do a check for when it is User Master, take out this disabled, allowing deletion, tried a use a removeAttribute, but returns this error:
Typeerror: Cannot read Property 'removeAttribute' of null
HTML:
<div class="modal-header">
     <h5 class="modal-title" id="exampleModalLongTitle">
        Tem certeza que deseja excluir o Ramo ?
     </h5>
     <button type="button" class="close" data-dismiss="modal" aria-label="Close">
        <span aria-hidden="true">×</span>
     </button>
</div>
<div class="modal-footer">
     <button type="button" class="btn btn-secondary" data-dismiss="modal">
        Não
     </button>
     <button type="button" class="btn btn-danger" data-dismiss="modal" (click)="del()" disabled id="delete">
        Sim
     </button>
</div>
TS:
  disableDelete() {
    let username = JSON.parse(localStorage.getItem('username'));
    console.log('Username: ', username);
    if(username === 'Arthur' || username == 'admin') {
      let btnRemove = document.getElementById('delete').removeAttribute('disabled');
    }
  }
						
Is using Angular?
– LeAndrade
Yes, but one of the most current
– Arthur Felipe