你好,我希望创建一个自定义对话框组件,并以声明方式插入它的内容,应该像这样:
app.action.dialog.component.ts:
@Component({
selector: 'app-action-dialog',
templateUrl: 'app/template/app.action.dialog.component.html'
})
export class ActionDialog {
showing: boolean;
constructor() {
this.showing = false;
}
show() {
this.showing = true;
}
hide() {
this.showing = false;
}
}
app.action.dialog.component.html:
<div id="overlay" class="valign-wrapper"
*ngIf="showing" (click)="hide()">
<div class="container valign">
<div class="card">
<div class="card-content">
<content select="[content]"></content>
</div>
</div>
</div>
</div>
使用示例:
<app.action.dialog>
<div content> example </div>
</app.action.dialog>
这不起作用,我该怎么做?有可能吗?