Questions tagged [injectable]

121 questions
0
votes
1 answer

Angular 2: How to return objects belonging to multiple classes extending superclass in one array?

I am trying to create a service in Angular 2-Native Script app that defines an array of news items, and has several methods that operates on the same data. These news items can be of different types, e.g. Big , small, etc each of which may have…
Anurag
  • 84
  • 3
  • 17
0
votes
0 answers

Angular 2 - Argument type RequestOptions is not assignable to parameter type RequestOptions

I try to create cutom Http class to hadle 401 error globaly. I have error when call super constructor - Argument type RequestOptions is not assignable to parameter type RequestOptions. Here is my code: @Injectable() export class HttpService extends…
0
votes
1 answer

consume Services from core module in app.component

Hi im new at angular 2 and Im trying to put in place all the things I have learned in angular.io. The problem is that I have readed about the core module, services, injectables ... and If I have lets say a core-module like this: import { NgModule }…
JesLopov
  • 3
  • 1
  • 4
0
votes
1 answer

Angular 2 / Jasmine / Karma error: Error: Can't resolve all parameters for Router: (?, ?, ?, ?, ?, ?, ?, ?). in config/karma-shim.js

Here is the service: import { Injectable } from '@angular/core'; import { Router, Event, NavigationStart, NavigationEnd, NavigationCancel, NavigationError } from '@angular/router'; @Injectable() export class LoaderService { public…
Phillip Berger
  • 2,317
  • 1
  • 11
  • 30
0
votes
1 answer

Do app.module providers and components share the same instance of an Injectable?

When I add the injectable CameraChannelService into ngModule's provider array: import { CameraChannelService } from './camera-channel.service'; @NgModule({ declarations: [ AppComponent, BabylonWallpaperDirective, MenuComponent, …
0
votes
1 answer

JMockit multiple generic interface injectable causes missing injectable for field

I am trying to mock a generic interface resource that has multiple options in one class. I found something that gets passed the named resources, that being to name the variable the same as the name parameter on the Resource. But if I have two…
Mimerr
  • 390
  • 1
  • 5
  • 14
0
votes
1 answer

Initialize autowired objects in TestNG unit tests

So here is my code: @Service("MyCode") public class CodeImpl implements CodeI { @Autowired private CodeMapper codeMapper; @Autowired private CodeAppService codeAppService; @Override public CodePOJO getCode(String myId) { …
Saumya A
  • 11
  • 3
0
votes
1 answer

Angular2 – Injectable service is not available

I have a service in my angular2 app called HttpClient This service is supposed to add an authorization header to each request the application is sending to my endpoints. import { Injectable } from '@angular/core'; import { Headers, Http,…
0
votes
1 answer

Angular 2 Http Service Injectable

I'm pulling a big object from my server using Angular 2 service when the website starts. The data I need to pull looks like this: { Edu: [...], Exp: [...], Links: [...], Portfolio: [...], Skills: [...] } And I set up the service…
thousight
  • 1,134
  • 1
  • 14
  • 39
0
votes
2 answers

Jersey 2.x Custom Injection annotation NULL

I'm following the 22.1. Implementing Custom Injection Provider paragraph https://jersey.java.net/documentation/latest/user-guide.html#deployment I defined my classes as below: public class PrincipalConfig extends ResourceConfig { public…
Alex
  • 1,515
  • 2
  • 22
  • 44
0
votes
2 answers

Custom InjectableProvider for method multi param injectable, Error in parsing

I have a hard time having a nice and clean way to implement this JsonParamInjectable. I searched on this forum and elsewhere but found nowhere an hint that would tell me how to implement it nice and clean. For a jaxrs method : public Object add( …
sstlaurent
  • 25
  • 7
-1
votes
0 answers

in angular app some time API called many time

in angular app i have load dashboard component and i have implemented statics api when page refresh API call one time after some time (estimate 2 minute) i have click view and go back again click view and go back do this action some we noticed…
-1
votes
1 answer

flutter injectable register subclasses types

following code uses injectable to configures getIt so when I ask for A in "prod" environment it gives me ImplementedA but i can't ask for ImplementedA explicitly. for example when I am in "test" environment and i need ImplementedA for testing it.…
reza
  • 1,354
  • 1
  • 7
  • 25
-1
votes
1 answer

In Angular >= 7, is there any advantage to using @Inject over declaring a class @Injectable?

I have seen what seem like older Angular examples in which dependency injection is done using the "@Inject" annotation ... import { Component, Inject } from '@angular/core'; import { ChatWidget } from '../components/chat-widget'; @Component({ …
satish
  • 703
  • 5
  • 23
  • 52
-1
votes
3 answers

providedIn Property In Angular Service Is not working

I am learning Angular DI, But The Provided Example (https://angular.io/guide/providers#providedin-and-ngmodules) Is Not Working Can Anyone Help me In Understanding Here Is The Link Of The Stackblitz I Am Working…
1 2 3
8
9