How to use ng-if/else in angular js?



How to use ng-if/else in angular js?..

Answer / Rajat Sharma

In AngularJS, `ng-if` and `ng-else` are used for conditional rendering. To use `ng-if`, you should wrap the HTML content that needs to be conditionally rendered inside `<div ng-if='expression'>` tags. If the expression evaluates to `true`, the content will be displayed; otherwise, it will be removed from the DOM.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More AngularJS Interview Questions

Why is it (potentially) bad if sharedmodule provides a service to a lazy-loaded module?

1 Answers  


Tell me can we use the open-source closure library with angular?

1 Answers  


What are the types of controller?

1 Answers  


Mention some advantages of using angular js framework.

1 Answers  


What do you understand by isolated unit tests?

1 Answers  


Why is it called angular?

1 Answers  


How many scope can an application have?

1 Answers  


Differentiate between Observables and Promises?

1 Answers  


Why is angular popular?

1 Answers  


What is flex in angular material?

1 Answers  


What is a service angular?

1 Answers  


What is data binding in angularjs and what is the difference between one-way and two-way binding?

1 Answers  


Categories