我正在學習從谷歌的新框架Angular2在Youtube:https://www.youtube.com/watch?v=SEM6-TkuOgo「......飾以注射」 - 通過這些視頻教程Angular2
我遇到不同類型的錯誤,當我開始瞭解服務如:
EXCEPTION: Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable.
EXCEPTION: Error: Uncaught (in promise): Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable.
angular2-polyfills.js:469 Unhandled Promise rejection: Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable. ; Zone: angular ; Task: Promise.then ; Value:
NoAnnotationError {message: "Cannot resolve all parameters for 'ContactListComp…ntactListComponent' is decorated with Injectable.", stack: "Error: Cannot resolve all parameters for 'ContactL…node_modules/angular2/bundles/angular2.js:477:94)"} message : "Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable." stack : "Error: Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated/
angular2-polyfills.js:471 Error: Uncaught (in promise): Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable.(…)
angular2-polyfills.js:469 Unhandled Promise rejection: Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable. ; Zone: ; Task: Promise.then ; Value: NoAnnotationError {message: "Cannot resolve all parameters for 'ContactListComp…ntactListComponent' is decorated with Injectable.", stack: "Error: Cannot resolve all parameters for 'ContactL…node_modules/angular2/bundles/angular2.js:477:94)"}
angular2-polyfills.js:471 Error: Uncaught (in promise): Cannot resolve all parameters for 'ContactListComponent'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'ContactListComponent' is decorated with Injectable.(…)
我不明白是什麼控制檯的真正含義我想註釋代碼的某些部分進行測試,以檢查時,我的代碼編譯或沒有。
如果覺得這個問題可能是解決這個部分在接觸list.component.ts:
constructor(private _contactService: ContactService) {}
而這也是一個在contact.service.ts:
return Promise.resolve(CONTACTS);
我截取了該項目中不同TypeScript文件的屏幕截圖:http://imgur.com/a/mqb5P
如果有人對調試此代碼有一些線索,我非常感謝! :)
PS:如果這可能有幫助,我可以從屏幕截圖複製/粘貼代碼。
是的,我確認我導入所需的所有文件,同時檢查兩次到存儲庫的路徑。我做了一個Plunker,所以這可能會更容易檢查代碼:http://plnkr.co/edit/TBeK15tcQlVSkAjRTPSJ – Dabolo
你是否有同樣的問題,通過刪除你的索引中的
無論有無 '都沒有變化。 –
Dabolo