Search code examples
htmlangularangular-ui

How to Disable inspect element in angular 4?


I have a list of element but I want to display just some of them so I use this code

[style.display]="!student.selected?'none':'block'"

But when I inspect the element I can see them all so my question is how I can change it with a secure thing??


Solution

  • You can use the *ngIf structural directive in your template (https://angular.io/guide/structural-directives). So in your case the component.html would contain:

    <div *ngIf="student.selected"></div>
    

    That would display the div element if a student exists.