angular-ng-if

How to add conditional attribute in Angular?

♀尐吖头ヾ 提交于 2019-12-12 06:58:34
问题 In my Angular project (v6) have a table as shown below and I list the records by checking index numbers of them. I want to display all the records on the first page (5 records) and animate using Angular-Animations only the first record. The following example displays all records with animation (but I just want to animate the first row). <ng-template pTemplate="body" let-row let-i="rowIndex"> <tr *ngIf="i==0" [@fadeInOnEnter]> <td> <a [routerLink]="['/detail/']">{{ row.Title }}</a> </td> <!--

Ionic 2 do not show slides when exercise is done

大兔子大兔子 提交于 2019-12-12 05:50:24
问题 Here I have the outcome of the JSONOBJ: I have ion-card in my home.html with the method navigate() which looks like this: navigate(event, exercise, exercise2, exercise3, exercise4){ this.navCtrl.push(exerciseSlides, { clickedExercise: exercise, secondExercise: exercise2, thirdExercise: exercise3, fourthExercise: exercise4 }); } and these are 2 of the cards: <ion-card *ngIf="oefening1" (click)="navigate($event, oefening1, oefening2, oefening3, oefening4)" class="{{ oefening1 }}" margin

ngIf with depending from number binding image in Angular 4

≯℡__Kan透↙ 提交于 2019-12-12 04:46:05
问题 <td *ngFor="let user of userService.users | async"> <div *ngIf="user?.data.apps.details[0].acknowledged as fooIcon"> <img *ngIf="fooIcon === "1" " src="./app/img/icones_sized/tick.png"/> <img *ngIf="fooIcon === "0" " src="nothing_appears"/> </div> I am trying to display an image if my ".acknowledged" is returning "1" and if it return "0" nothing should be displayed...It works with a string but not with a number..I don't really understand why.. 回答1: You should be using *ngIf...else , as <ng

ElementRef is undefined

╄→尐↘猪︶ㄣ 提交于 2019-12-11 23:14:12
问题 I’m working in an angular 6 application. I have a textarea that I’d like to give focus to as soon as the page loads. I’m not able to do so. Here is what the page looks like: <div fxLayoutAlign="begin"> <button mat-button color="primary" [routerLink]="['/Administration']"> <i class="far fa-arrow-alt-circle-left"></i> Back to Administration </button> </div> <div class="app-loading" *ngIf="_loading"> <mat-spinner diameter=100></mat-spinner> </div> <div *ngIf="!_loading"> <div class=

Not understanding use of template variables in *ngIf statement

旧巷老猫 提交于 2019-12-11 16:16:39
问题 my objective is to eventually make a setting where the user can change the number of rows while looking at the catalog (spiritwoodart.com). I didn't even get past the first stage of fiddling when I ran into a problem. Guessing its a fundamental misunderstanding. Having trouble finding help (i.e. my search sucks: "why cant i put a template variables in ngif statement"). Please let me know if more info is needed. Thanks for any and all insights, or even flames for my newbiness. So, when I

ng-if showing both elements during asynchronous call [duplicate]

China☆狼群 提交于 2019-12-11 15:26:20
问题 This question already has answers here : Show spinner GIF during an $http request in AngularJS? (26 answers) Closed 8 months ago . Using: v1.3.15 I understand what the coder was trying to accomplish by using two select menus for this. However, because the data being loaded in the select box is the result of an api call, there is a delay, so both select menus are displaying until the data has been retrieved. Is there a way to show the "searching" message option using a single select element

Angular directive ng-if does not evaluate conditional statement

≡放荡痞女 提交于 2019-12-10 15:53:54
问题 I'm new to web dev and AngularJS. I'm trying to use the directive ng-if to only display a div block if a list returned from the database is greater than 1, but it's not working. Am I misusing the directive? I've looked around and haven't found any solutions that work. Currently, both divs are displayed and the ng-ifs are ignored. <div> <div ng-if="listOfThings.length > 1"> <h1> {{listOfThings.length}} </h1> </br> <div ng-repeat="thing in listOfThings"> <label> {{ thing.name }} </label> </div>

error in getting value from input that have ngIf directive

吃可爱长大的小学妹 提交于 2019-12-10 14:46:08
问题 I get an exception Error TypeError and Error Context when the submit button is clicked. If I will delete the ngIf directive It will work as excepted, The Full StackTrace: PlayerNameFormComponent.html:8 ERROR TypeError: Cannot read property 'value' of undefined at Object.eval [as handleEvent] (PlayerNameFormComponent.html:8) at handleEvent (core.js:13547) at callWithDebugContext (core.js:15056) at Object.debugHandleEvent [as handleEvent] (core.js:14643) at dispatchEvent (core.js:9962) at eval

How to use “>” comparator in AngularJS ng-if statement

对着背影说爱祢 提交于 2019-12-10 13:08:35
问题 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: <div ng-if="foo>0" class="bar"> (HTML STUFF) </div> is read as: <div ng-if="foo"> (0 class="bar"> HTML STUFF) </div> I ended up getting around this by using ng-if="foo!=0" but I could probably use the less than comparator instead but I was just curious in case I absolutely HAD to use the greater than symbol for some reason. Or would I perhaps

Update <select> tag inside ng-if in angularjs

亡梦爱人 提交于 2019-12-10 11:13:32
问题 I would like to update the list of states on selection of country. I have researched a bit into this where it was recommended to use $parent as ng-if does not work on controller scope.But that too is not working for me. Can someone please help me understand how to get the values into state select control. Also I would also like to know what if there are multiple ng-if in my HTML. (again nested $parent.$parent.$parent... is not working) Plunker Link : Plunker Link "use strict"; var app =