Questions tagged [angular-ng-if]

'ngIf' is an Angular core directive that toggles the presence of the targeted element in the DOM. Do not use this tag for the 'ng-if' directive in the older AngularJS version.

ngIf is an Angular directive that alters the targeted element.

From the documentation:

Conditionally includes a template based on the value of an expression.

1223 questions
7
votes
2 answers

How to use ">" comparator in AngularJS ng-if statement

Is it possible to use the 'greater than' comparator in an ng-if in HTML? The problem is that the ">" symbol prematurely closes the HTML tag. ex. this:
(HTML STUFF)
is read as:
(0 class="bar">…
krhithm
  • 73
  • 1
  • 1
  • 4
7
votes
2 answers

Angular-slick ng-repeat $http get

I've been trying all the week end to display data (that I fetch with $http.get) in the slick angular carousel using ng-repeat, in vain... I've read about the well known issue: here and here. I tried to use the init-onload and data attributes, in…
7
votes
2 answers

ng-if in transcluded scope breaks scope inheritance

That fiddle illustrates the issue http://jsfiddle.net/LAqeX/2/ I want to create a directive that wraps a part of the page and hides it. And i would like to use ng-if to remove unnecessary bindings. But some black magic happens. This is my preferable…
Eugene Kostrikov
  • 6,799
  • 6
  • 23
  • 25
6
votes
1 answer

Angular 8 - *ngIf and mat-checkbox not working

I'm having an issue with the Angular Material Checkbox which I thought would be a relatively simple thing, but for some reason I can't get it to work. I have a div which I only want to show when the mat-checkbox is checked, but it doesn't seem to…
RocketMatt
  • 107
  • 4
  • 13
6
votes
2 answers

How to use the same template in ngIf

I have many conditions to show the same template. For example: