我有一个使用以下指令的简单Ionic2组件:
@View({
templateUrl: 'build/components/checkinDateInput/checkinDateInput.html',
directives: [ FocusDirective, Item, Label, TextInput ],
})在测试时,我得到了一个错误:No provider for Form! (Item -> Form)
我尝试将提供程序添加到我的规范中:
beforeEachProviders(() => [Form]);然而,Form在Ionic中是私有的,因此我似乎无法导入它(ionic-framework/util/form.d.ts):
/**
* @private
*/
export declare class Form {
private _blur;
...error TS2305: Module '".../node_modules/ionic-framework/ionic"' has no exported member 'Form'.
因为它不能导入,所以我不能在beforeEachProviders中模拟它,因为Form是未定义的。
beforeEachProviders(() => [
provide(Form, {useClass: MockForm})
]);我应该能够导入Form吗?还是我这样做是错误的呢?
发布于 2016-02-18 02:35:40
https://stackoverflow.com/questions/35469338
复制相似问题