Questions tagged arrays

Explore the latest questions and answers asked by our top developers.

I can’t select options of mat-select and can’t make the selected option appear in console

I have the following problem: I have a drop down list with 2 items. I need the first one to appear by default and that when selecting either of the two its value is shown in the console and saved in a variable. I have the following code: HTML <td> <mat-select name="tipoCdp" (change)="onChangeCdp($event.value)" [(ngModel)]="tipoCdpValue"> <ng-container […]

By Aragorn8806
Published
Categorized as angular, arrays, mat-select, ngfor, options Tagged , , , ,

Converting Array of object to another array of objects

I have an array of objects like in the following structure. [ { TaskID: “1001”, TaskName: “task1”, AID: “10”}, { TaskID: “1002”, TaskName: “task2”, AID: “10”} ] I have to create an array from the above array to the following structure. [ { “TaskID”: 1, “Value”: “1001”, “AID”: 10 }, { “TaskID”: 2, “Value”: “task1”, […]

By sarasm
Published
Categorized as angular, arrays, typescript Tagged , ,

Compare two values of different rows of an array in one table Angular

I’m new to Angular and I would like to request your help. I want to compare 2 values that are in different rows. The idea is that when selecting each row with the mat-checkbox, I obtain the data I need and the following condition is met: if the data in the "tipo de gasto" column […]

By Aragorn8806
Published
Categorized as angular, arrays, datatable, for-loop, request Tagged , , , ,

How to get days new Array from existing arrays input [closed]

I have below the array: var Array1 = [‘MON’, ‘WED’, ‘THU’, ‘SUN’]; var Array2 = [{ “Name”: “MON”, “FullName”: “MONDAY”, “ScheduleColumn”: 1 }, { “Name”: “TUE”, “FullName”: “TUESDAY”, “ScheduleColumn”: 2 }, { “Name”: “WED”, “FullName”: “WEDNESDAY”, “ScheduleColumn”: 3 }, { “Name”: “THU”, “FullName”: “THURSDAY”, “ScheduleColumn”: 4 }, { “Name”: “FRI”, “FullName”: “FRIDAY”, “ScheduleColumn”: 5 }, […]

By Ajay Thakur
Published
Categorized as angular, arrays, javascript, jquery, node.js Tagged , , , ,

From an array of objects, extract value of a property as array in angular

I have an array that looks like below: [ { "name":"ABC", "group":"A" }, { "name":"XYZ", "group":"A" }, { "name":"KLP", "group":"A" }, { "name":"AKG", "group":"B" }, { "name":"DIS", "group":"B" }, { "name":"FAC", "group":"B" }, { "name":"TAM", "group":"B" }, { "name":"NEW", "group":"C" }, { "name":"UTL", "group":"C" }, { "name":"WAC", "group":"C" } ] How can I sort this […]

By Khushboo Patel
Published
Categorized as angular, arrays, json, object Tagged , , ,

How to Declare and Initialize a New Array Inside ngFor?

I am trying to add some dummy records in an ngFor loop without having to declare the array in the component file. Is this possible? Something like this: <div *ngFor="let repeat of new Array(8)"> <ngx-skeleton-loader></ngx-skeleton-loader> </div> It works when I do it this way: <div *ngFor="let repeat of mockRecords"> <ngx-skeleton-loader></ngx-skeleton-loader> </div> And in the component […]

By Zach
Published
Categorized as angular, arrays, ngfor Tagged , ,

serialize array into object in JSON for API

I am working on Angular 12, in my TS file I have an array response from a file upload like this- [ { "id": "7", "name": "xyz", "job": "doctor", "preference": "1" }, { "id": "7", "name": "xyz", "job": "nurse", "preference": "2" }, { "id": "7", "name": "xyz", "job": "manager", "preference": "3" }, { "id": "7", […]

By sharpshooter
Published
Categorized as angular, arrays, javascript, json, typescript Tagged , , , ,

How do I remove commas in an array in Angular project

I am trying to call a list of actors from movies and in the DB I made they all have commas at the end of each string. When the array is called the content displays with 2 commas after each other and I am wondering how I can get rid of that. I have tried […]

By RDX10290
Published
Categorized as angular, arrays, comma, typescript Tagged , , ,

How to filter object array elements in the angular

how do I filter object array elements, filter only string that starts with: ‘001’ coming from a response (res), with the following code: service.ts listStore() : observeble{ const filter = {endpoint: ‘/point-filter’} } filter.component.ts public storeList: Array<interface> = [{ title: ”, name: ”}]; public filterStore (value: string) { if(value) { this.service.listStore({ name: value }).subscribe(res => […]

By josecarlos
Published
Categorized as angular, arrays, javascript, object, typescript Tagged , , , ,

How to hide and show Toc and how to increase chapters number by clicking on checkbox

In my project, I have added TOC Chapterwise and I have to change as I mention below. I want to check the checkbox only first checkbox which values free (it’s by default checked) I want to increase the chapter number when I click on the check box. (confuse how to add I value and its […]

By mishti
Published
Categorized as angular, arrays, node.js, show-hide Tagged , , ,
1 2 3 82

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq