为什么我的$mdDialog.prompt
不能正常工作,而$mdDialog.confirm
却可以正常工作?
我使用的代码是:
$scope.showPrompt = function(ev) {
var confirm = $mdDialog.prompt()
.title('What would you name your dog?')
.textContent('Bowser is a common name.')
.placeholder('dog name')
.ariaLabel('Dog name')
.ok('Okay!')
.cancel('I\'m a cat person');
$mdDialog.show(confirm);
}
在此期间,我在控制台中出现错误,原因是
TypeError: $mdDialog.prompt is not a function
但是,如果我使用以下代码,则可以正常工作:
$scope.showPrompt = function(event) {
var confirm = $mdDialog.confirm()
.title('Are you sure to delete the record?')
.textContent('Record will be deleted permanently.')
.ariaLabel('TutorialsPoint.com')
.targetEvent(event)
.ok('Yes')
.cancel('No');
$mdDialog.show(confirm).then(function() {
$scope.status = 'Record deleted successfully!';
}, function() {
$scope.status = 'You decided to keep your record.';
});
};
最佳答案
$mdDialog.prompt()
仅在v1.1.0rc1
中可用。
Here是工作示例,here是GitHub问题
请检查版本并相应地使用可用功能。
谢谢。