ionic2 - 无法解决所有参数错误
ionic2 - Cannot resolve all parameters error
我有以下 ts
代码。
#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]
我看过 FAQ, ionic NavController example and the documentation。但我无法发现它为什么抱怨的错误。对我来说,我似乎正确地导入了所有内容。
我可能做错了什么?
以下是我的系统信息
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
试试:
constructor(@Inject(NavController) nav:NavController)
我有以下 ts
代码。
#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]
我看过 FAQ, ionic NavController example and the documentation。但我无法发现它为什么抱怨的错误。对我来说,我似乎正确地导入了所有内容。
我可能做错了什么?
以下是我的系统信息
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
试试:
constructor(@Inject(NavController) nav:NavController)