filmov
tv
NgIf Directive - Angular (Tutorial #10)
Показать описание
In this video we will learn about NgIf Directive in Angular in Angular applications
What is NgIfDirective ?
NgIf is a structural directive that is used to add or remove the elements from the DOM on the basis of expression. NgIf works with true and false. If expression return true it will display the template (add the node in the DOM) and if expression returns false it will remove the node from the DOM
Suppose we have a variable userLoggedIn that will hold boolean value either true or false. If user is loggedin it will return true and then we want to display different template and if user is not logged in we will display different template
Syntax *ngIf="expression"
In programming language , we use else with if.Same in angular we you want to display different template if condition return false we can use else here as well.
but for this we will use angular element called ng-template. ng-template is an angular template that is used to display template with strutural directive. ng-template never get display directly. If get display on the basis of conditions using template reference variable and template reference variable starts with #(pound) sign
If you liked my channel , subscribe to it and like my videos. For any queries ask you question in comment section
you can also connect with me @
What is NgIfDirective ?
NgIf is a structural directive that is used to add or remove the elements from the DOM on the basis of expression. NgIf works with true and false. If expression return true it will display the template (add the node in the DOM) and if expression returns false it will remove the node from the DOM
Suppose we have a variable userLoggedIn that will hold boolean value either true or false. If user is loggedin it will return true and then we want to display different template and if user is not logged in we will display different template
Syntax *ngIf="expression"
In programming language , we use else with if.Same in angular we you want to display different template if condition return false we can use else here as well.
but for this we will use angular element called ng-template. ng-template is an angular template that is used to display template with strutural directive. ng-template never get display directly. If get display on the basis of conditions using template reference variable and template reference variable starts with #(pound) sign
If you liked my channel , subscribe to it and like my videos. For any queries ask you question in comment section
you can also connect with me @
Комментарии