Questions tagged [injection-tokens]
19 questions
0
votes
0 answers
Karma/Jasmine Angular InjectionToken Test fails unless I use fdescribe
I have the following spec test:
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { of } from 'rxjs';
import {…

Thomas Preston
- 697
- 1
- 7
- 19
0
votes
1 answer
Using MatSnackBar in a library
I have an issue with using MatSnackBar from within a library.
I have created a simple component which looks like this:

r3plica
- 13,017
- 23
- 128
- 290
0
votes
1 answer
Angular DI using injection token for model class
I am trying to do something here, but not sure if it can be done.
I want to create a model class like this:
import { Inject } from '@angular/core';
import {
Element,
Image,
} from '@situlive/situ-angular-components/contentful';
export class…

r3plica
- 13,017
- 23
- 128
- 290
-1
votes
1 answer
Angular 12 - how do you pass an object into your service
I abstracted some functionality from a component into a separate service, and injected the service into my component in order to use it. The problem I am facing now is that within my service, I need access to an object in my component.
How do I pass…

roonz11
- 795
- 1
- 13
- 24