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
-1
votes
1 answer

Angular 5 ngIfElse: Storing conditional result in a variable

Code: refresh
...
Waiting... Expected: rotate class applied to
Ruslan Lekhman
  • 696
  • 5
  • 9
-1
votes
1 answer

Conditionaly render template based on item in array

This is an simple example, real problem is more complex. cars: string[] = ['audi', 'opel', 'mazda']; isAudi: boolean = false; isOpel: boolean = false; checkCar(car):void { if(car == 'audi'){ this.isAudi = true; } }
dev_in_progress
  • 2,484
  • 2
  • 21
  • 32
-1
votes
2 answers

angular 2 - ngIf of component in seperated folders

I'm learning angular and i want to create a page with a top navBar. By pressing on a link on the navbar, I want the correspondent component will be shown. for example, if i press on the navBar on "ShoppingList" i want that only the shopping list…
MetaDude
  • 139
  • 5
  • 14
-1
votes
2 answers

angular2 - ngIf value is not updated in DOM

I'm currently facing an issue in updating a value in the DOM. To explain it quickly and as simple as possible, I currently have two components (A and B). B inherits from A, uses A's view as template but also inject its template into A (ng-content)…
NPanda
  • 41
  • 9
-1
votes
1 answer

ng-repeat and ng-if with conditions

{{item.msg}}{{item.cdate}}
Nicoleta Wilskon
  • 687
  • 1
  • 10
  • 32
-1
votes
1 answer

NgIF analog in angular 2

In my application every user has some permissions. For example view consist of 5 parts and 'normalUser' can work with 2 parts and 'superUser' with all 5. How can hide this 3 part for 'normalUser'? Is 'ngIf' good solution for this? Or someone knows…
John Doe
  • 3,794
  • 9
  • 40
  • 72
-1
votes
2 answers

ng-if not behaving as expected

I have an angular expression {{ userInfo.activities.ids }}, it is an array which I am sending to angular through php. Now I need to check a value in this array, I am using this :- [[userInfo.activities.ids.indexOf(1) != -1]] and It returns true or…
Always_a_learner
  • 4,585
  • 13
  • 63
  • 112
-1
votes
1 answer

ngIf doesn't update with variable

I have a very simple ng-if construction using two MD buttons and one AngularJS scope variable isPlaying. However, the ng-if doesn't seem to work along with the variable. I can see the variable changing as I click the buttons, using console tools,…
-1
votes
2 answers

Angular's ng-if not working on view

some days ago i have tried to work with ng-if even then my code works but now when i am trying it ,ng-if not working here is how i am doing inside ng-repeat. {{$index+1}} …
anujayk
  • 544
  • 7
  • 31
-2
votes
2 answers

Why is the *ngIf statement not working in Angular 13?

I just created a new Angular 13 project and ran into the issue, that any *ngIf statement is not just ignored, but the whole div is not shown at all. The html file I tested this with looks as follows:
This is text a
This…
-2
votes
1 answer

Angularjs: filtering ng-repeat with ng-if

Our team is building a widget in ServiceNow that shows task tiles for a user. Our code looks like this so far:
-2
votes
1 answer

*ngIf not updating after Object is filled

I have a simple list page in which i declare a pokemons variable that gets filled through an API: export class ListPage implements OnInit { public pokemons: any; constructor(public navCtrl: NavController, public pokemonProvider:…
Roykovic
  • 3
  • 4
-2
votes
1 answer

Why am I experiencing a "can't bind to x" error?

I used this code in my component: and add this to app.component.html: I'm…
Fatima
  • 1
  • 5
-2
votes
1 answer

Nested li element overlaps parent li

I have a nested list element as a menu. When I click on an item, I want the list to expand and the inner list to show up. But the inner li item (sub-menu item 1)overlaps the parent li (Menu item 2).
Ramya
  • 284
  • 2
  • 5
  • 18
-3
votes
2 answers

Why this *ngIf not render my paragraph checking the value of a variable?

I am working on an Angular application and I am finding the following problem using *ngIf directive. Into my HTML code I have put:

{{selectedAssetType}}

TEST

As you can see first I am printing the…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
1 2 3
81
82