我可以在 mdDialog 中添加变量或函数吗?
Can I add a variable or a function in a mdDialog?
我想向我的 mdDialog 添加一个变量或函数。我不确定如何创建自定义 mdDialog,我是 angularjs.
的新手
这是我的 mdDialog:
vm.dialog_up = function() {
vm.dis = true;
alert = $mdDialog.alert()
.title('Attention, ')
.content('Do you want to edit your Information?')
.ok('Close');
$mdDialog
.show( alert )
.finally(function() {
alert = undefined;
});
}
我想给 .ok 按钮添加一个功能。
JavaScript 是一种非常自由的语言,它允许您向对象添加属性和方法。例如:
var modal = {};
modal.x = 5;//this assigns the value of `5` to the newly attached property `x`
modal.testMethod = function() {
//Do something here
}
PS:
虽然就我个人而言,我认为修改框架对象会导致副作用。
我想向我的 mdDialog 添加一个变量或函数。我不确定如何创建自定义 mdDialog,我是 angularjs.
的新手这是我的 mdDialog:
vm.dialog_up = function() {
vm.dis = true;
alert = $mdDialog.alert()
.title('Attention, ')
.content('Do you want to edit your Information?')
.ok('Close');
$mdDialog
.show( alert )
.finally(function() {
alert = undefined;
});
}
我想给 .ok 按钮添加一个功能。
JavaScript 是一种非常自由的语言,它允许您向对象添加属性和方法。例如:
var modal = {};
modal.x = 5;//this assigns the value of `5` to the newly attached property `x`
modal.testMethod = function() {
//Do something here
}
PS: 虽然就我个人而言,我认为修改框架对象会导致副作用。