use ngif to chcek binding value code example

Example 1: ngif

--While (t/f boolean variable called "flag") is true This button will be visible + click button executes function Once this "flag" becomes false this button disapears

Example 2: angular conditional directives

//if 
//if [condition]==true the div will be shown //for

{{i}} {{data.title}}

//the data contained in an array will be displayed element by element //similar to the function .map() in React // ngStyle (conditional Style)

{{i}} {{data.title}}

//if the index of the element is 1 or 0, the background will be red, if it is over 1 the background will be green

Tags:

Misc Example