我使用ECMAScript 6来建立我的鳕鱼,我试图建立一个模板有一个组件的对话框,我无法找到工作方式 这是我的HTML:
.thump_text
这是我的JS:
<div>
<md-button ng-click="rq.openRequestDialog()">Open Dialog</md-button>
</div>
这是RequestDialogController:
class RequestsController{
constructor($scope,$mdDialog){
'ngInject';
this.$scope = $scope;
this.$mdDialog = $mdDialog;
}
openRequestDialog() {
console.log("dialog ->", this.$mdDialog);
this.$mdDialog.show({
template: '<requestDialog request="rd.openRequestDialog()"></requestDialog>',
clickOutsideToClose: true,
bindToController: true,
controllerAs: 'rd',
controller:RequestDialogController
});
};
$onInit(){
}
}
export const RequestsComponent = {
templateUrl: './views/app/components/requests/requests.component.html',
controller: RequestsController,
controllerAs: 'rq',
bindings: {}
};
我的网站是SPA(Laravel - 后端Angular - frontend),我编译所有文件,组件都在单独的文件夹中(每个组件都有自己的文件夹(html,js,css))
我无法使其正常工作,错误是
class RequestDialogController{
constructor($mdDialog){
'ngInject';
this.$mdDialog = $mdDialog;
//
}
openRequestDialog() {
console.log("works ->");
}
closeRequestDialog(){
console.log("close ->");
// this.$mdDialog.cancel('Close');
}
$onInit(){
}
}
export const RequestDialogComponent = {
templateUrl: './views/app/components/requestDialog/requestDialog.component.html',
controller: RequestDialogController,
controllerAs: 'rd',
bindings: {
request:'<'
}
}
,有什么建议吗?