Questions tagged arrays

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

How do i set multiple values to one parameter in Angular using HttpParams?

I have an array containing strings, similar to this const animals = [‘Cat’, ‘Dog’, ‘Lion’] I’m trying to append the values into one parameter using HttpParams in Angular. My goal is to get a url that looks like "localhost:xxxx/Endpoint?TypeOfAnimal=Dog&Cat&Lion" I have tried the following: let params = new HttpParams(); params = params.append(‘TypeOfAnimal’, animalTypes.join(‘&’)); Which resulted […]

I want array of riskAssessmentDetail on get request typesctipt

{ "msg": "Ok", "data": { "asset": { "id": 7, "assetName": "postasset", "assetType": "Server", "serialNumber": "8888", "assetLocation": "Vadodara", "assetOwner": "upatil", "valueOfAsset": 15444, "riskOwner": "navaera", "image": null, "imageMultipart": null }, "riskAssessmentTreatmentDetails": { "7": [ { "riskAssessmentDetail": { "id": 619, "assetMasterDTO": null, "threatMasterDTO": { "threatId": 20, "threatDesc": "Threat4", "riskAssessmentDetail": [ ] }, "vulnerabilityMasterDTO": { "vulnerabilityId": 32, "vulnerabilityDesc": "Vulnerability1", […]

By ronak patel
Published
Categorized as angular8, angularjs, arrays, json, typescript Tagged , , , ,

I have a list in which multiple Time-In or Time-Out , Break In or Break out

I have a list in which multiple Time-In or Time-Out , Break In or Break out. i want to calculate total duration from Time-In to Time-Out Here is data. const data = [ { timeSheetDetailActivityId : 0 , timeSheetDailyActivityId : 0 , entryDateTime : ’02:28′ , activityTypeId : ‘Time In’ , comments : ‘dgdfgdfg’ , […]

By h kl t F zi
Published
Categorized as angular, arrays, javascript, jquery Tagged , , ,

Angular form: use api-call correct to prefill dynamic form (my nested array now always has 3 items)

Hope you can help me in the following question. I have an dynamically set up form in Angular, with the option to add and remove fields from a nested array. Now the next step is to pre-populate the array in case somebody wants to edit the list. This all works fine, I create the list […]

By planetstarbucks
Published
Categorized as angular, arrays, forms, nested Tagged , , ,

Array save in a Json structure – angular

Good day,I am doing an app on angular where create a flow of steps, I use angular material stepper for this; I need to save all the inputs in a json structure when the user finishes the all the steps, now I save all the inputs in the array but a don’t how transform the […]

forEach and ngFor Duplicates Data if New Data is added

I experienced this scenario when a new data is added in my Firebase Firestore Database. forEach will iterate the values of the Document (Firebase Document) while the ngFor will rendered the data in frontend. This duplication of data will only happen if the page is not reloaded and when a new data is added, if […]

By minalisa
Published
Categorized as angular, arrays, javascript, loops, typescript Tagged , , , ,

angular get item array for each menu

I have two list with thre colum (menu,item menu and order ) and need to display for each memu for list1 the array item for list 2, the condition is if item.order < menu(I+1:next menu).order, I create the scenario in picture for my need and my problem was I have all the list of item […]

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

Angular nested array filtering based on another array (Navigation menu)

I have a navigation menu + a list of user roles. It’s actually a legacy application and that’s why I have so many user roles. Basically, I want to show the navigation menu based on the roles the user has. A user can have multiple roles. A menu item can be accessed by multiple roles. […]

How to find duplicate values in object and push in array to create distinct array of objects in Angular8

I am getting below response from API, but i want to format it for iteration to reach the correct values. In below objects, i am getting column makeLineName and based on this column, i want to create one types array and push whole object as it is on types array. Suppose for ex – In […]

By Tinku Tiwari
Published
Categorized as angular, arrays, javascript, json, typescript Tagged , , , ,

Find all instances of an array where object contains one of the following values

I’m developing an angular app, and I have this array of objects: public persons: Array<Persons> = [ { name: ‘Kurt’, groups: A, D }, { name: ‘Brian’, groups: D }, { name: ‘Lars’, groups: B, C, D }, ]; And I have another array of values: private _selectedGroups: Array<string> = [A, B, C] I now […]

By Niklas
Published
Categorized as angular, arrays, typescript Tagged , ,
1 97

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