Questions tagged arrays

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

How to add an element in an array which is in map form? [closed]

I have a map type in an array coming from database in typscript. Its form is: this.mapColumns=[{"1":"Number1","2":"Number2","3":"Number3"}] I want to add an element : "4":"Number4" inside it so that its form would be: this.mapColumns=[{"1":"Number1","2":"Number2","3":"Number3","4":"Number4"}] Source: Angular Questions

By Tony
Published
Categorized as angular, arrays, collections, typescript Tagged , , ,

How to use inde fxrom ngfor to get array [index] item in mat-cell

I use this item for a loop of all columns in Columns, the index is not working for the array iterator value. How do I get this to work? <ng-container matColumnDef= "{{columnName}}" *ngFor=" let columnName of Columns; index as i"> <th mat-header-cell *matHeaderCellDef>{{columnName == ‘Expand’ ? ” : columnName}} <td mat-cell *matCellDef="let data">{{data.Days[i][columnName]}} data.Days is […]

By user1190265
Published
Categorized as angular, arrays, javascript Tagged , ,

Get values from array of objects, inside an object

So, let’s say I have this object, and inside of it, I have an array of objects. let partys = { "id": 241, "name": "Rock Party", "type": "party", "days": [ { "id": 201, "day": "Monday" }, { "id": 202, "dia": "Friday" } ], } How do I get only the value of "day"? Like this: […]

By Luiz Carlos
Published
Categorized as angularjs, arrays, javascript, json, object Tagged , , , ,

Map row and columns to store in firebase database

I am using google sheet data to display in my page using angular. When I tried to display data it comes in the form of array and field names as 0 1 2 3 . I wanted to know how can we map row and column so that I can display the data in correct […]

By Awani
Published
Categorized as angular, arraylist, arrays, json, typescript Tagged , , , ,

Search matches in array

I am currently writing a simple program where i need to look if the entered input string is also in the array. To make it simple If a persons types ‘Ai’ i want the program to show everything in the array that contains the letters’Ai’. Result would be ‘Airplane’, ‘Air’, ‘Airport’, ‘Airfield’ etc. Anyone knows […]

By Quentiuz
Published
Categorized as angular, arrays, string, typescript Tagged , , ,

How to store map values into an array to its first position using typescript?

I have a map and want to store map values into an array but to its first position only. My map is: this.mapValues.set("1","First"); this.mapValues.set("2","Second"); this.mapValues.set("3","Third"); Then afterwards I want it to convert it in form: [{1:First, 2: Second, 3: Third}] Source: Angular Questions

By Tony
Published
Categorized as angular, arrays, collections, maps, typescript Tagged , , , ,

Issue ordering an array with nested objects using ngx-order-pipe

I am facing a problem when wanting to order an array of objects that also have objects inside, I am using ngx-order-pipe… The component.html <table> <thead> <tr> <th></th> <th class="sortable"> <span class="sort" (click)="sort(‘coln1’)"> <img src="{{ROOT}}/assets/arrow_off.png"/> </span> <span style="margin-left: 2%;">Coln1</span> </th> … <th>&nbsp;</th> </tr> </thead> <tbody> <tr *ngFor="let element of supplies | orderBy: orderHeader: false" > […]

By Lombardinho
Published
Categorized as angular, arrays, columnsorting, javascript Tagged , , ,

How to iterate over arrays in angular 12?

I am trying to iterate over an object that’s in an array of an array, however, I’m not able to display the data in the front-end. I tried this method: <div *ngFor="let item of events of event | keyvalue"> {{item.key}}:{{item.value}} </div> and this one: <div *ngFor="let item of events of event | json"> Test: {{item}} […]

By Bjorn Liza
Published
Categorized as angular, angular12, arrays, json Tagged , , ,

Map row and column goolesheet response using angular

I am trying to map row and column of google sheet. Right now I am getting [![Array list response][1]][1] Column: (3) [‘Id’, ‘Name’, ‘Major’] 0: "Id" 1: "Name" 2: "Major" Row: 0: Array(3) 0: 202 1: "word" 2: "comp" 1: Array(3) 0: 203 1: "sina" 2: "pmoc" what I am trying is to get data […]

By Awani
Published
Categorized as angular, arraylist, arrays, json, typescript Tagged , , , ,

expanding/ collapsing a recursive tree in angular

I have aleady implemented the functionality to collapse and expand the whole tree with all its nodes. what I am trying to approach now is expanding a single item from the tree without expanding other nodes. by clicking on (>). expanding the underlying children of that single node by clicking on (>>) here is how […]

By salma
Published
Categorized as angular, arrays, javascript, typescript Tagged , , ,
1 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