如何在 $mdDialog 中添加表单并提交如何发送到电子邮件。我试图从对话框中获取 from 但无法得到任何线索。
我的控制器是:
App.controller('MainController', function ($scope, $mdDialog) {
console.log("reaching mainController");
$scope.showPrompt = function (ev) {
console.log("reaching showprompt");
// Appending dialog to document.body to cover sidenav in docs app
var confirm = $mdDialog.prompt()
.title('Please give us your details')
.textContent('We are happy to quote for your interiors in your new home.')
.placeholder('Name')
.ariaLabel('Dog name')
.initialValue('')
.placeholder('Name')
.ariaLabel('Dog name')
.initialValue('')
.targetEvent(ev)
.ok('Submit')
.cancel('Later');
$mdDialog.show(confirm).then(function (result) {
$scope.status = 'You decided to name your dog ' + result + '.';
}, function () {
$scope.status = 'You didn\'t name your dog.';
});
};
我想在页面加载中显示对话框,我在 ng-init 中添加了该功能
<div ng-controller="MainController" ng-init="showPrompt($event)">
模态在加载时间迅速加载。我是不是在某个地方出错了。