Q: What is the difference between ng-if and ng-show directives in AngularJS?
-
A
There is no difference between ng-if and ng-show
-
B
ng-if removes the element from the DOM, while ng-show hides the element using CSS
-
C
ng-show removes the element from the DOM, while ng-if hides the element using CSS
-
D
ng-if and ng-show are used for different purposes and cannot be compared
B
Answer:
B
Explanation:
Answer: B) ng-if removes the element from the DOM, while ng-show hides the element using CSS
Explanation: The ng-if directive removes the element from the DOM when its condition is false, while the ng-show directive hides the element using CSS when its condition is false.
Related Topic:
Share Above MCQ