2016-02-28 59 views
1

我有以下ts代碼。ionic2 - 無法解決所有參數錯誤

#home.ts 
import {Page, NavController} from 'ionic-framework/ionic'; 

@Page({ 
    templateUrl: 'build/pages/home/home.html' 
}) 
export class HomePage { 
    constructor(nav: NavController){ 
    } 
} 

我收到以下錯誤消息。

Error: Cannot resolve all parameters for 'HomePage'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'HomePage' is decorated with Injectable. 
    at NoAnnotationError.BaseException [as constructor] 

我已經在FAQionic NavController exampledocumentation看看。但是我無法發現它爲什麼抱怨的錯誤。對我來說,好像我正確導入一切。

我可能做錯了什麼?

下面是我的系統信息

Your system information: 

Cordova CLI: 5.4.1 
Gulp version: CLI version 3.9.0 
Gulp local: 
Ionic Version: 2.0.0-beta.1 
Ionic CLI Version: 2.0.0-beta.17 
Ionic App Lib Version: 2.0.0-beta.8 
ios-deploy version: Not installed 
ios-sim version: 5.0.2 
OS: Mac OS X El Capitan 
Node Version: v4.1.1 
Xcode version: Xcode 7.0.1 Build version 7A1001 

回答

3

嘗試用:

constructor(@Inject(NavController) nav:NavController) 
+0

這個工作對我來說,非常感謝 – sameera207

相關問題