Angular材质$mdDialog与第二位置持有人
Angular material $mdDialog with second place holder
我正试图添加第二个输入到一个角度材料对话框,但我不确定它是否可能。我试图添加Test2占位符,但没有工作。提前感谢您的帮助。
$scope.showPrompt = function (ev) {
$scope.statusTopic = '';
var confirm = $mdDialog.prompt()
.title('Test?')
.placeholder('Test1')
//.placeholder('Test2')
.targetEvent(ev)
.ok('Okay!')
.cancel('Cancel');
下面是一个使用自定义对话框- CodePen的示例
标记<div ng-controller="MyController as vm" ng-cloak="" ng-app="app">
<md-button class="md-primary md-raised" ng-click="vm.open($event)">
Custom Dialog
</md-button>
<div ng-if="vm.showText" layout="column">
{{vm.placeholder1}}
<br>
{{vm.placeholder2}}
</div>
<script type="text/ng-template" id="test.html">
<md-dialog aria-label="Test">
<div layout-padding layout="column">
<md-input-container>
<label>Placeholder 1</label>
<input ng-model="vm.placeholder1">
</md-input-container>
<md-input-container>
<label>Placeholder 2</label>
<input ng-model="vm.placeholder2">
</md-input-container>
<md-button ng-click="vm.save()" class="md-primary">Save</md-button>
</div>
</md-dialog>
</script>
</div>
JS
angular.module('app',['ngMaterial'])
.controller('MyController', function($scope, $mdDialog) {
this.open = function(ev) {
this.showText = false;
$mdDialog.show(
{
templateUrl: "test.html",
clickOutsideToClose: true,
scope: $scope,
preserveScope: true,
controller: function($scope) {
},
});
};
this.save = function () {
this.showText = true;
$mdDialog.cancel();
}
})
演示:https://material.angularjs.org/latest/demo/input 文档:
https://material.angularjs.org/latest/api/directive/mdDialoghttps://material.angularjs.org/latest/api/service/美元mdDialog
相关文章:
- jquery试图按名称获取按钮位置
- 我可以获得相对于被点击元素的确切点击位置吗
- 谷歌地图固定位置覆盖
- 在单击任何位置时隐藏元素,而不检查每次DOM单击
- 循环比赛位置算法
- es6 相当于下划线查找位置
- jQuery循环在特定位置暂停
- 引导程序:在导航栏中,显示悬停在单个位置的基于Li Link的不同内容
- 自定义函数中的光标位置
- 安卓平台上的QWebView HTML5地理位置
- DIV并排,位置不正确
- 使用jQuery更改元素的顶部位置
- 在谷歌地图上绘制位置数据库
- 跟踪jqplot垂直折线图的鼠标位置
- 设置画布渲染器的x和y位置
- 固定位置菜单时滚动,直到它击中一个相对容器的底部
- 根据页面的位置突出显示文本中的字符
- 传单缩放控制位置错误
- 如何将返回的值应用于多个不同位置的多个选择器
- Angular材质$mdDialog与第二位置持有人