Questions tagged [angular-arrays]
31 questions
4
votes
3 answers
Copy array of Objects in angular 2
I have two array called 'persons' and 'persons2',
The 'persons2' array would to be copy of 'persons' array,
But the problem is when I copy it, and I want to change the second array, the first array is also changing. This is my code:
export class…

Jack
- 89
- 3
- 12
2
votes
1 answer
Create new array from existing array with specifc node values
I have following array:
[
{
fileName: "test.pdf",
fileUrl: "https://test-url1.com/test.pdf",
isDeleted: true
},
{
fileName: "test.pdf",
fileUrl: "https://test-url1.com/test.pdf",
isDeleted: true
}
]
Now I need to…

Sam
- 136
- 7
2
votes
1 answer
Angular ngIf: Identifier 'length' is not defined
My component has the property transfers$ that is an observable that can comes with an array or an object that contains the error message.
I can only input [items] when transfers$ is Transfer[]. But even using condition

Doug
- 129
- 1
- 12
2
votes
1 answer
Angular 9 mapping a json response to array
I have this interface
export interface Student {
cf: string,
firstName: string,
lastName: string,
dateOfBirth: Date,
description?: string,
enrollmentDate?: Date
}
I want to populate an array of students with a http get…

dc_Bita98
- 851
- 2
- 17
- 35
2
votes
1 answer
Pass the right element's data from ngfor loop to the child component
Im looking to inject the data from a ngfor loop on the parent component into a child component. This child component is supposed to render a modal with the data of the right element in the parent's ngfor loop, when I click on the respective child…

BEvo
- 357
- 6
- 18
2
votes
1 answer
Easy way to double bind length of angular array where object has 'true' for a specific property?
I have the following list of students:
students = [{name:'Jordan', passed:true}, {name:'Kyle'},{name:'Jess'},
{name:'Sam', passed:true}
]
I want to be able to, in an HTML template, get the length of the array where the…

Rolando
- 58,640
- 98
- 266
- 407
1
vote
1 answer
Hide/Show form field(s) on mat-checkbox check Angular
I am trying to show and hide the search filter input field which is basically my form field with the check of a checkbox that is in my search filter button.
I am using *ngIf here to show and hide the field. It doesn't seem to work the issue is, it…

Vishal
- 21
- 8
1
vote
1 answer
I need to convert one of the form arrray in my formGroup
This is my ngOnInit
ngOnInit() {
this.formGroup = this._formBuilder.group({
basic: this._formBuilder.array([this.basicGroup()]),
experience: this._formBuilder.array([this.experienceGroup()]),
education:…

Ananthu A Nair
- 328
- 2
- 9
1
vote
1 answer
Angular array filter is not working on a list of string
I have an array of string, and want to filter out a particular string after some operation. But, it seems I am doing something wrong there.
this.displayUser.followers.filter(userId=>userId !== this.loggedUser.userid);
Here, followers is an array of…

Daisy
- 73
- 1
- 10
1
vote
1 answer
How can I store value in a nested object array in Angular 8
I am creating an order entry form where we shall store both master and details data. Below I am showing you my entity details which wrote in typescript.
export interface IOrder {
id: number;
customerId: number;
…

Shiv Shankar Maiti
- 119
- 1
- 11
1
vote
1 answer
Angular ngFor with dynamic adding of objects
Please check the video: https://screencast-o-matic.com/watch/cqQQj2tA22
I'm adding dynamically objects to an array and would like to set the values once the objects are added. Now when I'm adding a new object to the array all the input textboxes in…

Laziale
- 7,965
- 46
- 146
- 262
1
vote
1 answer
Angular Viewmodels and usage in components
I'm trying to bind viewmodels to a view through component. Initially I did this in the component and it was almost working:
model: any = {
TenantId: '',
CustomFieldName: '',
quantities: []
};
quantity: any = {
…

Laziale
- 7,965
- 46
- 146
- 262
1
vote
2 answers
How display data from json array in angular 7
I have a json data set with arrays from my ASP.net Core web api, i want to show that data in angular html page. can you help me.
angular 7 cli
home-page.component.ts
ngOnInit() {
this.serverService.getAllProductData().subscribe(
…

Thevin Malaka.
- 151
- 1
- 7
- 20
0
votes
2 answers
Want to access index of array in angular
I am getting array in this way, check attached image.
Now I am trying to display edit icon as this below :
{
header: 'Edit',
field: 'id',
view: (value: string, obj: any) => { return `angular
angular-grid
angular-arrays
angular-json

Sam
- 136
- 7
0
votes
1 answer
How do I calculate the Amount value for the each row, without replacing the newest amount value. (Angular)
Adding the Rows. Here getting the quantity and the price value using the change event.
`

Onella Natalie
- 15
- 4