我似乎无法调试我的代码有人可以帮助我吗?
I can't seem to debug my code can anyone help me?
我正在尝试为我的 angular 应用程序创建查看详细信息功能。
我已经尝试在 google 上搜索如何解决我的错误,但是 none 当前的解决方案对我有用。
core.js:15724 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[MovieDetailComponent -> MoviesService]:
StaticInjectorError(Platform: core)[MovieDetailComponent -> MoviesService]:
NullInjectorError: No provider for MoviesService!
Error: StaticInjectorError(AppModule)[MovieDetailComponent -> MoviesService]:
StaticInjectorError(Platform: core)[MovieDetailComponent -> MoviesService]:
NullInjectorError: No provider for MoviesService!
at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:8896)
at resolveToken (core.js:9141)
at tryResolveToken (core.js:9085)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982)
at resolveToken (core.js:9141)
at tryResolveToken (core.js:9085)
at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982)
at resolveNgModuleDep (core.js:21218)
at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21907)
at resolveDep (core.js:22278)
at resolvePromise (zone.js:831)
at resolvePromise (zone.js:788)
at zone.js:892
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
at Object.onInvokeTask (core.js:17290)
at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
at drainMicroTaskQueue (zone.js:601)
在您的服务中,必须在 class 声明之前有装饰器
@Injectable({
providedIn: 'root'
})
这会将服务注入您的应用程序 (https://angular.io/tutorial/toh-pt4)
我正在尝试为我的 angular 应用程序创建查看详细信息功能。
我已经尝试在 google 上搜索如何解决我的错误,但是 none 当前的解决方案对我有用。
core.js:15724 ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[MovieDetailComponent -> MoviesService]: StaticInjectorError(Platform: core)[MovieDetailComponent -> MoviesService]: NullInjectorError: No provider for MoviesService! Error: StaticInjectorError(AppModule)[MovieDetailComponent -> MoviesService]: StaticInjectorError(Platform: core)[MovieDetailComponent -> MoviesService]: NullInjectorError: No provider for MoviesService! at NullInjector.push../node_modules/@angular/core/fesm5/core.js.NullInjector.get (core.js:8896) at resolveToken (core.js:9141) at tryResolveToken (core.js:9085) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982) at resolveToken (core.js:9141) at tryResolveToken (core.js:9085) at StaticInjector.push../node_modules/@angular/core/fesm5/core.js.StaticInjector.get (core.js:8982) at resolveNgModuleDep (core.js:21218) at NgModuleRef_.push../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (core.js:21907) at resolveDep (core.js:22278) at resolvePromise (zone.js:831) at resolvePromise (zone.js:788) at zone.js:892 at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423) at Object.onInvokeTask (core.js:17290) at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422) at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195) at drainMicroTaskQueue (zone.js:601)
在您的服务中,必须在 class 声明之前有装饰器
@Injectable({
providedIn: 'root'
})
这会将服务注入您的应用程序 (https://angular.io/tutorial/toh-pt4)