ngfor Questions

2

Solved

The following scenario would be pretty easy in javascript but I got some problems getting it worked in Angular. I got an Array like: array a = ( "id" = 0, name = random(), column = 1, 2 or 3, bl...
Kenweigh asked 24/4, 2017 at 4:56

2

Solved

I am adding several inputs using ngFor in a template driven form and I would like to add corresponding error messages for when the inputs are invalid. Normally if I was not using ngFor I would use ...
Politi asked 29/3, 2017 at 2:40

1

Solved

In Angular 2 ngFor, is it possible to declare a local (short-hand) variable? I mean something like this, but I am not sure about the syntax: <li *ngFor="let userHasAgenda of agendas | async; l...
Depend asked 20/3, 2017 at 4:24

1

Solved

I am experimenting with Angular2 and Angular Material. I used *ngFor to let Angular generate the <input> elements for me. However, in the resulting webpage, the generated element does not h...
Bridging asked 18/3, 2017 at 18:40

2

Solved

Below is my array of JSON objects: { "tagFrequency": [ { "value": "aenean", "count": 1, "tagId": 251 }, { "value": "At", "count": 1, "tagId": 249 }, { "value": "faucibus", "count":...
Ettore asked 11/3, 2017 at 16:45

1

Solved

I have a simple ngFor that loops through an array. However, I've added a condition that while the index is < 5 keep add the tag. and After that, I want to add an extra tag just once that will be...
Delirium asked 25/2, 2017 at 16:35

1

Solved

I've seen many animation tutorials for the entering or leaving elements ("New element" on the image below), but the rest of elements (Element 1 and 2), that are pushed apart usually just teleport t...
Feathering asked 21/2, 2017 at 19:14

2

Solved

So i have this Component of a from with an @Output event that trigger on submit, as follows: @Component({ selector: 'some-component', templateUrl: './SomeComponent.html' }) export class SomeCom...
Joaquin asked 13/9, 2016 at 13:31

2

Solved

Can some one please let me know how to toggle icons while doing ngFor? Problem Statement: I'm using *ngFor to loop through an array and display category names. On click of day I need to open...
Harar asked 3/2, 2017 at 5:16

2

Solved

Apparently ngfor generates divisions of the divs one by one, and when it finishes placing all the divs one down the other, presenting a bad design, I want to get something like this: [1] [2] [3] [...
Decant asked 3/2, 2017 at 4:57

3

Solved

I'm getting a JSON file from an api, as you can see there is an Object inside an Object called "rates" unfortantly *ngFor can walk through on array only. I am looking for something that I ca...
Holland asked 28/10, 2016 at 13:0

2

Solved

I have an ngFor that creates several PrimeNG buttons. Right now, the buttons appear directly after each other on the same row - I would like each button to display on its on line vertically. How do...
Tumbledown asked 30/1, 2017 at 17:35

1

Solved

I have a situation where I am looping over a group of objects and for each object I have a button that when clicked should toggle a variable of isActive to true, but I want this to be specific to j...
Dowling asked 25/1, 2017 at 0:16

2

===final updated== http://plnkr.co/edit/WKRBB7?p=preview since I use ngModel in a form, I must add name attribue. and my mistake is that I used same value as its name. <form #myform="ngForm"...
Trilemma asked 14/1, 2017 at 16:50

1

Solved

How can we initialize and manipulate a check box value? I've looked at quite a number of examples, but haven't been able to get any to work. I'm trying to present a N x M table where the rows repr...
Horehound asked 3/12, 2016 at 17:7

2

Solved

I can think of a few ways that I might hack this but I'd like some advice on the most 'Angular' way of doing it. I've put together an example of what I'm doing. The main component uses NgFor to i...
Alimentation asked 3/12, 2016 at 16:48

1

I started using Angular2 (final version) and i'm having some problems with *ngFor. I've built the following component tree: main -> dashboard -> alerts Unhandled Promise rejection: Templa...
Salinas asked 22/11, 2016 at 9:36

2

Solved

I have the following code for a select dropdown: <select id="UnitOfMeasurementId" name="UnitOfMeasurementId" [(ngModel)]="UnitOfMeasurementId"> <option *ngFor="let unit of UnitOfMeasurem...
Jack asked 21/11, 2016 at 22:39

1

Solved

I need to filter items inside an ngFor loop, by changing the category in a drop-down list. Therefore, when a particular category is selected from the list, it should only list the items containing ...
Epistemology asked 19/11, 2016 at 18:1

1

I'm trying to use *ngFor in my code. For some reason, I'm getting this error message when running the app: I've triple checked all property names are good, and there aren't any directives...
Displume asked 16/11, 2016 at 21:38

2

Solved

I´m fairly new to Angular2, and i want to read out a json file. It´s working, that I get the file from a REST-Client, i can save the file in a local variable in a component and furthermore I´m able...
Astroid asked 26/10, 2016 at 5:34

1

Solved

When i write dynamic "for" attribute in label, i get error. example: <div *ngFor="let question of questions; let i = index;"> <input id="ques-{{i}}" type="radio" name="selected" [...
Needlecraft asked 25/10, 2016 at 11:41

3

My component has an array of strings I want to display in a table. However, I want the table to have 4 columns per row. How can I use *ngFor to show 4 strings per row? I'm aware there are so...
Pennington asked 11/10, 2016 at 18:58

1

Solved

I wanted to repeat particular element several amount of time, so I'm using *ngFor directive with hardcoded array like [1,2,3,4,5,6,7,8,9,10] and that got worked awesome. I achieved what I wanted to...
Galloot asked 11/10, 2016 at 13:8

3

Solved

I have an Angular 2 component which loads and shows a list of checkboxes to the user within *ngFor, the list can also be filtered based on a key. I need to select all the filtered items and add the...
Poll asked 26/9, 2016 at 12:39

© 2022 - 2024 — McMap. All rights reserved.