Hello,
I am not sure if it is a bug or not however i am getting No provider for UrlHelperService!.
The provider is specified in home.module.ts.
Thank's
HomeComponent_Host.ngfactory.js? [sm]:1 ERROR Error: StaticInjectorError[UrlHelperService]:
StaticInjectorError[UrlHelperService]:
NullInjectorError: No provider for UrlHelperService!
at _NullInjector.get (core.js:923)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveToken (core.js:1211)
at tryResolveToken (core.js:1153)
at StaticInjector.get (core.js:1024)
at resolveNgModuleDep (core.js:10586)
at NgModuleRef_.get (core.js:11807)
at resolveNgModuleDep (core.js:10586)
home.module.ts
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { CommonModule } from '@angular/common';
import { homeRouting } from './home.routing';
import { HomeComponent } from './home.component';
import { OAuthService } from 'angular-oauth2-oidc';
@NgModule({
imports: [
CommonModule,
homeRouting,
FormsModule,
HttpClientModule,
],
providers: [OAuthService],
declarations: [HomeComponent]
})
export class HomeModule {
}
home.component.ts
import { Component, OnInit } from '@angular/core';
import { OAuthService } from 'angular-oauth2-oidc';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
private async ConfigureAuth(): Promise<void> {
}
constructor(private oauthService: OAuthService) { }
async ngOnInit() {
await this.ConfigureAuth();
}
}
Hello, I'm having the same exact issue. Did anyone manage to fix this? Thanks.
You have to import the module
imports: [
...
OAuthModule.forRoot(),
...
]
Hey sorry of the delay, yeah that was the issue !
I was watching this https://www.youtube.com/watch?v=RSqREkxe2z0&t=520s they guys did added oAuthModule in providers and it seem to work for him!
You have to import the module
imports: [ ... OAuthModule.forRoot(), ... ]
This worked for me, thanks :)
Most helpful comment
You have to import the module