Skip to content
Advertisement

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 any other solution will be welcome. Answer In your constructor/ngOnInit

Accessing nested arrays with dynamic depth via indices

I’m fairly new to typescript and I have some issues to access an object in array with dynamic depth. For example: To get Folder4 I’d use the dot notation like: this.folder[0].children[0].children[1] Now I was wondering, if there is a way to dynamicly access the object via the position array without iterating over the whole structure. I managed to get it

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: DoctorSpecialitiesServiceResolver And the service is in ActivatedRoute. Everything works fine for now. But I need to

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 invokes warning as below:

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 lots of things,

how to save stimulsoft report js to server in angular?

I have a component for report designer and assign method to onSaveReport event but in that method my component memeber is undefined this is error: Cannot set properties of undefined (setting ‘body’) TypeError: Cannot set properties of undefined (setting ‘body’) at $.onReportSave [as onSaveReport] (http://localhost:4200/features-stimulsoft-report-stimulsoft-report-module.js:1206:28) at $.invokeSaveReport (http://localhost:4200/assets/lazyBundles/stimulsoft/stimulsoft.designer.js:30:82619) at $.raiseCallbackEventAsync (http://localhost:4200/assets/lazyBundles/stimulsoft/stimulsoft.designer.js:30:86029) at http://localhost:4200/assets/lazyBundles/stimulsoft/stimulsoft.designer.js:30:78818 at ZoneDelegate.invokeTask (http://localhost:4200/polyfills.js:12178:35) at Object.onInvokeTask (http://localhost:4200/vendor.js:72788:33) at

Alternatives to Deferred (anti?-)pattern when awaiting for user interactions in Angular

I’m building a game using Angular which has the following mechanics: An Angular service checks the game state and requests a required user interaction. A mediator service creates this request and emits it to the relevant Angular component using a RxJS subject. A response to this request is awaited in this mediator service, game doesn’t go on until request is

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 am trying to do something like this,

Advertisement