Questions tagged [injectable]

121 questions
0
votes
0 answers

@nestjs/common - ReferenceError: common_1 is not defined - NestJs testing with Jest

I'm trying to set up testing using Jest for a NestJS service. When I run jest, a ReferenceError is thrown that says "common_1 is not defined" for both the service and controller tests. I think this is related to an import from @nestjs/common: import…
Pand0
  • 11
  • 4
0
votes
1 answer

How to make @factoryParams nullable in dart/Flutter?

I'm trying to use the @factoryParam annotation of injectable package by using it in a class. But whenever I try to run the build runner to generate the config file, it gives me an error saying the Factory params must be nullable. import…
Nikhil Bharadwaj
  • 867
  • 4
  • 24
  • 42
0
votes
1 answer

flutter: Pubspec.yaml Error for Analyzer and injectable_generator versions to run build_runner

I cant use build_runner: ^2.1.11 in flutter without adding analyzer: ^4.2.0.when its add it's possible to generate build_runner files like .g.dart and freezed.dart without any issues. but when it comes to injectable_generator: ^1.5.3 I can't even…
Ritvik adoor
  • 21
  • 1
  • 2
0
votes
2 answers

inject ngx-cookie-service in @Injectable

i have a Authentication Service in Angular, which should handle log in and out for me. So this is an @Injectable({providedIn: 'root'}). In this service i want to use the ngx-cookie-service (https://www.npmjs.com/package/ngx-cookie-service). My…
0
votes
0 answers

Value from service 'undefined' in onInit

I have defined this service in my Angular Application. import { Observable } from 'rxjs'; @Injectable({ providedIn: 'root', }) export class LoginstatusService { logBtn: string = ''; logStat: string = ''; login: any; constructor() {} …
0
votes
0 answers

Angular multiple modules providing same service

I am using a library (FontAwesome for Angular) which provides two services under the same name: Lets say the first one is the real one: @Injectable({ providedIn: 'root', }) export class Service { } @NgModule({ exports: [...], }) export class…
0
votes
0 answers

Angular Service in Service not able to inject due to circular dependancy

I have a service. When I inject another service into it. I get error related to params not defined. ServiceA (Object, Object, ?, Object) I tried making a third service to separate out concerns as well but wont work. I tried to make another service…
0
votes
1 answer

Using injectable for third party abstract class in flutter

I have used package http in my project and thus, I have Client's instance (which comes from package http) as a dependency, which is an abstract class. So, how should I annotate with proper annotations? In injectable's documentation, there is…
Biplab Dutta
  • 444
  • 3
  • 12
0
votes
1 answer

Flutter injectable abstract class

I am trying to use injectable for my project but when i try this part of code: @injectable abstract class TodoRepository { Future> getDayDodo(DateEntity date); } after run build_runner this error…
reza
  • 1,354
  • 1
  • 7
  • 25
0
votes
3 answers

Importing Injectables and Angular Services

I am learning about Injectables and Services in Angular and I am not clear about certain importing and default characteristics about injectables. Specifically, when should a service in Angular: Have the @Injectables tag? I had seen a blogpost that…
0
votes
1 answer

Error: inject() must be called from an injection context but can't find origin

I'm using angularfire's authentication service to register and login users to my application but when I trigger the register or signin method, I get the following error: Error: inject() must be called from an injection context I've tried setting…
Andre
  • 91
  • 8
0
votes
1 answer

Save data in observable (ionic 4)

I would like to save user data after login in an observable and retrieve the data later in the profile page. I have a simple user.service.ts @Injectable() export class UserService { private _user: BehaviorSubject = new…
sniperalex117
  • 79
  • 3
  • 9
0
votes
1 answer

Injection Token Not Resetting on Component Change

I'm not sure of the small details here, so maybe this isn't even supposed to work—but it seems like there should be some solution to this. I have a parent component that uses two child components in tabs, like so:
Ynhockey
  • 3,845
  • 5
  • 33
  • 51
0
votes
1 answer

Nest can't resolve dependencies of custom service

I am basically follow this tutorial with very minor modifications:link I am using nest 6.14.2 on node 12.10.0. When running my app I get: > recon-backend@0.0.1 start C:\Users\e5553079\Desktop\Node_Projects\recon-backend > nest start [Nest] 8324 …
0
votes
1 answer

How to share the same dependency Injection Tree with tsrynge?

I'd like to have only one instance of each class per child container. import "reflect-metadata"; import {injectable, container, singleton} from "tsyringe"; const count = { bar: 0, foo: 0, fao: 0 } @injectable() class Foo { …
Stefdelec
  • 2,711
  • 3
  • 33
  • 40
1 2 3
8 9