What Is The Difference Between Ng-show / Ng-hide And Ng-if Directives?

  • .NET
  • ADO.NET
  • Android
  • ASP.NET
  • C#
  • Databases & DBA
  • Design Patterns & Practices
  • Java
  • Learn iOS Programming
  • OOP/OOD
  • SharePoint
  • Software Testing
  • Web Development
  • WPF
  • View All
Tripat Bala Singh What is the Difference between ng-show / ng-hide and ng-if directives? By Tripat Bala Singh in Angular on Mar 06 2018
  • 1
  • 12k
  • 3
  • Post Your Answer
Submit
  • Prashanth Kumar Mar, 2018 29

    1) The ng-if directive removes or recreates a portion of the DOM tree based on an expression. If the expression assigned to ngIf evaluates to a false value then the element is removed from the DOM, otherwise a clone of the element is reinserted into the DOM. 2)The ng-show directive shows or hides the given HTML element based on the expression provided to the ng-show attribute 3)ng-hide for hide the elements conditionally.For example if we want to hide a div based on a condition then we need to pass a boolean expression to ng-hide directive.

    • 2
  • Mahesh Verma Mar, 2018 13

    ng-show/ng-hide can show and hide the rendered data, that is, it always kept the rendered data and show or hide on the basis of that directives. However, ng-if can only render data whenever the condition is true. It doesn't have any rendered data until the condition is true.We can say, ng-show/hide internally kept data but cannot display on UI, however, ng-if cannot keep data until the condition is true.

    • 2
  • Bhairab Dutt May, 2018 8

    The ng-show and ng-hide both are directive . The difference between is : ng-show directive will show the html element if expression resilts is true and ng-hide directive hide the html element if expression result is true .

    • 0

Most Popular Job Functions

  • Developer (2376)
  • Programmer (1288)
  • Sr. Developer (826)
  • Sr. Programmer (449)
  • Fresher (398)
  • Tech Lead (378)
  • DBA (244)
  • Team Lead (187)
  • Project Lead (83)
  • Architect (28)
View All

MOST LIKED QUESTIONS

  • Why do you want to leave your current company? What are the advantages of using REST in Web API? What is ASP.NET Core? How to iterate through ArrayList in jQuery? What is the difference between TempData keep() and peek() function? A class provides a default constructor for me. I write a constructor that takes a string as... Can multiple catch blocks be executed in a C# program? what is Sealed class What were your responsibilities in your previous job ? What Operating Systems Node.js Supports

Từ khóa » Ng-show Vs Ng-hide Vs Ng-if