Angular · Junior · Question 74 of 75
How do you show a button only to admins and a label to everyone else?
@if (user().isAdmin) {
<button>Delete</button>
} @else {
<span>Read only</span>
}- ✓Correct answer: With
@if/@elseblocks - 2With
[hidden]on the root element only - 3With CSS
display: none; the template can't branch
Explanation
@if removes the elements from the DOM. Hiding UI is not security - the server must also check permissions.