I have a angular 5 ("@angular/core": "5.1.2") app and I keep getting this
error
Uncaught Error: Can't resolve all parameters for FooComponent: (?).
Service:
@Injectable()export class FooService { }
Component:
@Component({template: '<p></p>'})export class FooComponent {
constructor(private s: FooService) { }}
Module:
@NgModule({
declarations: [ AppComponent, FooComponent ],
bootstrap:[ AppComponent ],
providers: [ FooService ] })export class AppModule {}
My tsconfig:
{
"compilerOptions": {
"baseUrl": "",
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": false,
"lib": [
"es6",
"dom"
],
"mapRoot": "./",
"module": "commonjs",
"moduleResolution": "node",
"rootDir": "./app",
"outDir": "../dist",
"sourceMap": true,
"target": "es5",
"noEmitOnError": true,
"typeRoots": [
"./node_modules/@types"
]
},
"include": [
"./**/*.ts"
]}
Any idea what I am missing? Note that I am using es6 lib and @Injectable
doesn't
take any parameters. I can't seem to find many good examples.
Generally how do we debug DI on angular?
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
<<attachment: di_problem.zip>>
