ngfor Questions

2

Solved

The trackBy function (e.g. in an ngFor) provides two arguments: index and item (from the collection being iterated over). Is there a way to pass additional information (as parameters?) to th trackB...
Nessy asked 3/10, 2017 at 19:20

1

Solved

I have added a component in a parent component. Child component gets data from server and shows it in a modal. Problem is that it is not updating data in realtime. Here is html of child component:...
Greisen asked 6/5, 2019 at 10:45

3

Solved

Here's my object (It has n number of dynamic keys. I've only shown two in the example below) let obj = { abc:["some text", "some more text"], xyz:["more text", "what do you think?", "I'm tired now...
Celibacy asked 20/8, 2016 at 23:21

5

Solved

I'm trying to set default value as checked on a checkbox inside my ngFor. This is my array of checkbox items: tags = [{ name: 'Empathetic', checked: false }, { name: 'Smart money', checked: t...
Podesta asked 13/7, 2017 at 19:52

3

Solved

I have a list of over 50 items. I would like to show only the first 10 items, and I would have a button that when clicked shows the next 10 items, and which clicked again, the next 10 items until a...
Ikhnaton asked 10/3, 2017 at 0:35

2

Solved

I have a <button> in a ngFor loop and I want it to be disabled after the user clicks on the button. There is a button for each element of the loop so I have to differentiate them using a diff...
Niple asked 13/11, 2018 at 8:40

7

Solved

I have a list of strings that I want to iterate through, but I want to be able to filter them using a search term. Like this: <div *ngFor="#item in list | search: searchTerm">{{ item }}</...
Gangrene asked 6/5, 2016 at 7:52

2

Solved

In the loop body in the code below: <ul> <li *ngFor="let article of articles; index as i"> <a>{{ articles[i].title }} -- {{i}}</a> <p>{{ articles[i].body }}</...
Douala asked 11/10, 2018 at 8:55

2

Solved

i'm new to angular 4 and i'm displaying data inside an array using ngFor.Each addon has a number of users and list of these users(id,role,etc) that i managed to get from the backend(spring boot pro...
Transfiguration asked 12/2, 2018 at 16:31

2

Solved

I am currently having trouble when paginating a list of clients in Angular 2. Here is a snippet of my code: <tr *ngFor="let client of eClients | filter:term | paginate: { itemsPerPage: 20, curr...
Earlearla asked 25/4, 2017 at 23:26

2

Solved

The title might seem weird but what im talking about is basically what this link is doing. Im look for a way to use the current iterated person in a <tr> outside of the *ngFor scope. In the...
Mckinnie asked 31/8, 2016 at 12:35

2

Solved

I have problem with pass selected checkbox (which is iterated) to ngModel. <label class="btn btn-outline-secondary" *ngFor="let test of tests" > <input type="checkbox"> </labe...
Gregorygregrory asked 11/9, 2018 at 10:41

1

Solved

I would like to display an array using ngFor but before the first element I want to display a card (the user can click inside to show a modal) Here the code : <div fxFlex="25" *ngFor="let pr...
Robledo asked 6/9, 2018 at 12:39

5

Solved

I have an Angular2 app with a button that can add another loan to my loans. My *ngFor is pretty simple also: <div *ngFor="let loan of myLoans"> <label>{{loan.name}}</label> &l...
Pantagruel asked 27/4, 2017 at 17:27

1

We have some arrays like: heroes: Hero[]; villains: Villain[]; ... puppies: Puppy[] and a template like <p *ngFor="let individual of heroes"> {{ individual.name }} - {{ individual.mobil...

2

The API I am working against gives me the following structure in response: "data": [ { "id": 5, "name": "First name", "parent": 0 }, { "id": 1, "name": "Second name", "parent": 5 }, { "id":...
Intermixture asked 30/1, 2017 at 14:59

2

Solved

I want to list items in an array vertically with cards, but there is no space between them. I tried to use padding but it seems it doesn't work. card image How can I have these cards spaced? &lt...
Kliment asked 20/8, 2018 at 13:4

2

Solved

I am trying to build an angular project . In my project I want to show a list of books ,I have a SmallBookView Component for a single book and I want to use ngFor to show many other books./ however...
Falk asked 14/8, 2018 at 21:27

1

Solved

I have a strange behaviour of @ViewChildren corresponding to children components generated by ngFor. @ViewChildren query does not see element standing in array for a quite long time. All my code is...
Pops asked 7/8, 2018 at 14:33

8

Solved

In Angular 1 I have written a custom directive ("repeater-ready") to use with ng-repeat to invoke a callback method when the iteration has been completed: if ($scope.$last === true) { $timeout(()...
Jiujitsu asked 5/3, 2016 at 20:9

2

Solved

I am fairly new to angular and have what I think is a basic problem. I create my map like <agm-map [latitude]="lat" [longitude]="lng"> <agm-marker [latitude]="location.lat" [longitude]...
Torras asked 27/10, 2017 at 9:51

5

Solved

I'm trying to clean up my template code. I have the following: <ul> <li *ngIf="condition" *ngFor="let a of array1"> <p>{{a.firstname}}</p> <p>{{a.lastname}}</p&...
Kinky asked 21/12, 2016 at 18:19

3

Solved

I have the following Component: class MyComponent { public mode = 'v'; readonly modes = ['v', 'a', 'd']; .... } Now I want to use an ngFor to display buttons for all modes in modes except the...
Dimetric asked 21/11, 2017 at 6:45

3

Solved

Is it possible to create input fields with a ngFor in a template driven form and use something like #name="ngModel" to be able to use name.valid in another tag? Right now we have a dynamic list of...
Mickens asked 21/9, 2016 at 11:50

4

Solved

I'm trying to give a dynamically assigned id for a div inside a *ngFor. I would like the divs to be called 'wave1, wave2, wave3' etc. <li *ngFor="let episode of episodes; let i = index&quot...
Yokefellow asked 31/3, 2018 at 16:0

© 2022 - 2024 — McMap. All rights reserved.