双角度2和角度材料2的双向转换

时间:2017-01-29 09:01:49

标签: angular angular2-template angular-material2

我有两个组件,我想从中转换md-hint 在md-input标签内的上面一个,md-input应该从那里开始 渲染它。
现在这不起作用。任何人都可以向我解释如何 我可以达到我想要的结果吗?

@Component({
  selector: 'my-test',
  template: `
    <div>
      <md-input placeholder="Test">
        <ng-content selector="md-hint"></ng-content>
      </md-input>
    </div>
  `,
})
export class MyTest {
  name:string;
  constructor() {
    this.name = 'Angular2'
  }
}

@Component({
  selector: 'my-app',
  template: `
    <div>
      <h2>Hello {{name}}</h2>
      <my-test>
        <md-hint>This is my hint</md-hint>
      </my-test>
    </div>
  `,
})

Here is the plunker for it

0 个答案:

没有答案