Good afternoon, I have a problem when I want to return an array of objects from an external function. I have declared an Object class with 2 properties, its constructor and one that works where I return an array with more than 50 objects for this example I only put 4 objects The problem is that I want to call
Tag: angular
How to filter numbers in a drop down list?
I have an HTML table with a numeric variable called statut. The statut variable is a drop-down list, it has two values -> 1 and 9. The method in typescript seems to be correct I think my problem is the HTML, how to make the HTML know that it must filter a number and not a string? Thank you for
Javascript How to update all Property Names in nested object
I would like to return a new object with the updated property names in the nested object. For example in the fakeData below, I would like to update all the property names from: The data that I am trying to update : So far I’ve tried to use the recurrsion to do this but the subtask are not updating correctly
api endpoint progress loading
How do create a progress loader that is based on the uploadFile method/service , for example on the method below it should show keep loading unless the uploadFile is success , what is needed to and to be considered? should a finalize(() be added ? Thanks. #html code #tscode Answer You can have a flag called uploadInProgress and set that
How to detect changes in a directive when innerHTML code is updated in angular?
I am testing a directive that is adding to divs, these are implementing innerHTML, the directive is in charge of highlingthing with a click on the div (changing the color), but I want to change when the component is updating the content in the innerHTL as well, the problem is that the ngOnChanges hook is not aware of any changes.
How to avoid duplicate items in a drop down list to display?
I would like to create a drop-down list and retrieve the elements from a webService. My problem is that I would like to avoid displaying duplicate items because I have 9999 items. Here is the JSON file. enter image description here Do you think it is possible to do this? Because, I have no idea how to program this? The
ViewChild is undefined in angular 13
I am trying to call view child of a child component from parent and getting undefined in the console. see the image also see the stack blaze for the same https://stackblitz.com/edit/angular-ivy-k4m2hp?file=src%2Fapp%2Fhello.component.ts Please help to get the child component this.testChildComponent So that i can call ngOnInit of child from parent. this.testChildComponent.ngOnInit() Answer if you set your viewChild { static: true }
Image uploading in Angular
I was trying to upload an image using Angular to a google storage bucket. And everything is working fine with Postman. But I’m stuck with angular typescript. Can anyone suggest to me a way to do this? .html file .ts file } .service file } No any error occurs on the backend side. It worked fine with Postman. Im not
Get an array of items from an object- typescript
I have an object with the below structure: the order is of type Order[] and users of type UserData[] Whenever I try to get the list of users per order : let users = this.Order.users it says that: users don’t exist on type Order[], can anyone explain for me why. Answer Order is an array of objects, you need to
How to sort the string of date format in an array
Input output 22 March 2015, 09 May 2015, 18 August 2015, 25 December 2015, 25 jun 2016 Answer Subtracting 2 dates returns the difference between the two dates in milliseconds if a date is smaller than b returns negative values a will sorted to be a lower index than b.