Skip to content

Tag: angular

Angular – function in ngFor called multiple times

I have a template: Component and service: I want to fetch the list of trucks in my template based on a parameter cargo.id. I’m getting data from backend but the function getTrucksByUserIdAndRules(cargo.id) is called multiple times. I know this is not a good practise to use functions inside template and …

Unable to inject dependency in resolved service

I’ve came across this specfic problem in my Angular project architecture: I have one component that need to load different service depending on current URL. It’s done by resolving service like in example below. ChartRoutingModule When user enter specific url the service is resolved: DoctorSpeciali…

Return forkJoin selectively

I have a case where an application should return menu based on given context. Below are the sources of menuA and menuB. Given my limited knowledge and experience on rxjs, I was hoping something like the snippet below can accept a string of menuA or menuB to return an observable of the required menu: The above…

Ag-grid Image rendering

I’m working on a project where I have to use ag-grid for table. I’m using angular for the project. But the problem is I want to show the user’s profile picture and name in one cell in ag-grid like the image I was attached. But I couldn’t render the image. How can I do this? I tried lot…

How to filter an array of complex object

I have an array of users and each user has a array of tags and I have an array of selected Tags What is the best way in ES6 to filter the users by selected tags and my selected tags are and I expect to receive a result as Answer Filter the users, and then check that every id is

angular data modify before send the service

I need to modify my object. please check below function The item, included 3 values: code, avCode, ageCode. When I send the ‘item’ all three values pass to the service . According to my requirement I need to send only code and avCode. how can I modify ‘item’ before pass to service. I a…