Angular 在自定义组件中使用离子输入

Angular 在自定义组件中使用离子输入,angular,ionic2,Angular,Ionic2,我正在尝试在angular2/ionic2中创建一个包含输入的自定义组件,下面是代码: import {Component} from "angular2/core"; import {ItemInput} from "ionic-framework/ionic"; @Component({ directives: [ItemInput], selector: "add-input", template: ` <ion-input clearInput&

我正在尝试在angular2/ionic2中创建一个包含输入的自定义组件,下面是代码:

import {Component} from "angular2/core";
import {ItemInput} from "ionic-framework/ionic";


@Component({
    directives: [ItemInput],
    selector: "add-input",
    template: `
    <ion-input clearInput>
      <input type="text" value="">
    </ion-input>
  `
})
export class AddInput {
    constructor() { }
}
从“angular2/core”导入{Component};
从“ionic框架/ionic”导入{ItemInput};
@组成部分({
指令:[ItemInput],
选择器:“添加输入”,
模板:`
`
})
导出类附加输入{
构造函数(){}
}
问题在于,在最终页面/视图中,离子输入似乎被忽略(没有应用样式,甚至无法单击)。如果我将代码按原样移动到主视图,那么它就可以工作。向此自定义组件添加按钮时,如

<button>ok</button> 
ok
导入按钮(并将其添加到该组件的指令列表中)也可以。因此,我不确定是否需要对ItemInput组件执行一些特殊的操作才能在自定义组件中使用,或者我只是遇到了一个bug

使用离子2.0 alpha49


有什么线索吗?

爱奥尼亚指令导入爱奥尼亚指令

import {Component} from '@angular/core';
import {IONIC_DIRECTIVES} from 'ionic-angular';

@Component({
    selector: 'add-input',
    template: `
    <ion-input clearInput>
      <input type="text" value="">
    </ion-input>
    `,
    directives: [IONIC_DIRECTIVES]
})

export class AddInput {
  constructor() {}
}
从'@angular/core'导入{Component};
从“离子角度”导入{IONIC_指令};
@组成部分({
选择器:“添加输入”,
模板:`
`,
指令:[爱奥尼亚大学指令]
})
导出类附加输入{
构造函数(){}
}

希望得到回答,否则请查看出现此错误的人员:

../node_modules/ionic-angular/index"' has no exported member 'IONIC_DIRECTIVES'
在离子3中,指令声明已更改。组件不包括指令,模块将离子指令绑定到组件。在您的模块中使用此选项
IonicPageModule.forChild(MyComponent)

在这里找到了答案:


希望这有帮助,干杯

死链接,请修复我在尝试时遇到的错误。。。(发布版本)
[ts]模块的“c:/…/node_modules/ionic angular/index”没有导出的成员“ionic_指令”。
import { IonicModule; IonicPageModule } from 'ionic-angular';
import { MyApp } from './app.component';
import { MyComponent } from '../directives/my-directive/my-directive';

@NgModule({
  imports: [
    IonicModule.forRoot(MyApp),
    IonicPageModule.forChild(MyComponent) // Here
  ],
  declarations: [MyApp, MyComponent]
})