如何在ES5中使用ng.material.MdDialog?

时间:2017-05-07 16:23:24

标签: angular material-design

我们需要使用Angular 2的ES5风味和材质2。

我们一直坚持使用素材对话框。到目前为止我们所做的是:

var parentComponent = ng.core.Component({
    templateUrl: '/parentComponent.html'
    selector: 'parentComponent'
}).Class({
    constructor: [app.material.MdDialog, function(dialog) {
        var _this = this;
        _this.dialog = dialog;
    }],
    openDialog: function() {
        var _this = this;
        var reference = _this.dialog.open(' ? what goes here?');
    }
});

var dialogComponent = ng.core.Component({
    selector: 'dialogComponent',
    templateUrl: '/dialogComponent.html'
}).Class({
    constructor: [ng.material.MdDialogRef, function(dialogRef) {
        var _this = this;
        _this.dialogRef = dialogRef;
        // why do we need dialog ref at all?
    }]
});

当我们致电_this.dialog.open时,我们会遇到此错误:

caused by: No component factory found for [object Object]. Did you add it to @NgModule.entryComponents?

我们无法找到MdDialog的实际示例,我们也无法解决此问题。有人可以帮忙吗?

0 个答案:

没有答案