为什么我的$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.';
});
};
您正在使用哪个版本,因为'.prompt'只能从v1.1.0rc1及以上版本获得。 – anoop
我正在使用1.3.15版,所以还有其他方式可以使用它。 –