74 questions
1 vote
2 answers
493 views
How to update the useClass in providers based on the condition in Angular
I am trying to update the useClass based on the condition. When I am trying to change the tab I want to update the service. So I wrote one factory function for that. let useClassFactory = ( conn: ...
1 vote
0 answers
584 views
Register Angular providers dynamically during runtime
Is there a way to register module/component providers in a dynamic way? I know about the useFactory option but this is only about a specific provider. What I want to achieve is to register some ...
1 vote
1 answer
112 views
How to return $http.post() object with factory function?
When I tried to return a $http.post() object from a factory function with Angular, it throws me this error: Below is my code: AngularUtils.js Fenrir.factory('AngularUtils', function ($http, $log, $...
4 votes
1 answer
1k views
Angular - Dynamic Component Rendering Wrong Data
Solved As mentioned below by Aaron, the "Other Option" approach works without issues and feels a lot cleaner. I'll leave the updates and everything in case anyone in the future has a similar ...
0 votes
0 answers
112 views
duplicate xhr request angularjs factory
I am working with Angular.Js and using factory to load my data, I have an issue where my request are duplicated.i am injecting another module named filter module. my search module var searchjob = ...
2 votes
1 answer
1k views
Inject query parameter into dependency provider factory in Angular
I want a value from the window.location search parameters passed to the body of a dependency provider factory, ideally in an idiomatic Angular way. Use case: writing my first Angular app I have the ...
0 votes
0 answers
145 views
how to include factories inside the ts file in angular 8
I have this factory which has ngx-timpicker factory.ts , i want to include it in my ts file to use the factory in my time.ts file , but I am getting error in my import line in time.ts file that error -...
13 votes
4 answers
13k views
Angular: Metadata collected contains an error that will be reported at runtime: Lambda not supported
In my Angular app, I'm trying to use a factory provider in my module: export function getMyFactory(): () => Window { return () => window; } @NgModule({ providers: [ { provide: WindowRef,...
1 vote
1 answer
502 views
Angular Dynamic Html Template component with event emitter
I am trying to extend the functionality of this component by adding a generic event emitter import { Component, Directive, NgModule, Input, ViewContainerRef, Compiler, ComponentFactory, ...
0 votes
0 answers
169 views
How can I get data in a specific order in angular js
I have a problem current in which i am using angular js to fetch and display data. The following is the code var angularDynamicsCRM = angular.module('angularDynamicsCRM', ['ngResource']); /// ...
1 vote
1 answer
90 views
using angular factory with $http
I need translate value factory. this factory receive translateData from server. and angular controller call convertValue function. but $http is async method so controller get undefined value. because ...
-1 votes
1 answer
226 views
How do you reuse code in Angular? [closed]
I have controller which fetches some data and adds some extra items based on the information. The information should be searchable. I have working code for that now, but was wondering what is the best ...
1 vote
0 answers
825 views
Angular 5: Component Factory Binding
I'm using a component factory to load in different components via a Block input which states characteristics of the block - internal variables. Then, depending on the variables set, the factory will ...
8 votes
3 answers
12k views
What is a factory in Angular
I was reading an article of Max NgWizard K, about how Angular updates the DOM. I came across the following: For each component that is used in the application Angular compiler generates a factory. ...
1 vote
4 answers
89 views
Share Variable between controllers of different routes - AngularJS
I'm new on Angularjs and I'm trying to build my first application. Let's say I have to routes that loads two different views: 127.0.0.1:8080/site 127.0.0.1:8080/site_details Maybe having two different ...