user6934713 user6934713 - 10 months ago 87
Javascript Question

Angular material $mdDialog with second place holder

I am trying to add a second input to an angular material dialog, but I am not sure if it is possible. I tried to add the Test2 placeholder but didn't work. Thank you for the help in advance.

$scope.showPrompt = function (ev) {
$scope.statusTopic = '';
var confirm = $mdDialog.prompt()

Answer Source

Here's an example using Custom Dialog - CodePen


<div ng-controller="MyController as vm" ng-cloak="" ng-app="app">
  <md-button class="md-primary md-raised" ng-click="$event)">
    Custom Dialog
  <div ng-if="vm.showText" layout="column">

  <script type="text/ng-template" id="test.html">
    <md-dialog aria-label="Test">
        <div layout-padding layout="column">
            <label>Placeholder 1</label>
          <input ng-model="vm.placeholder1">
            <label>Placeholder 2</label>
          <input ng-model="vm.placeholder2">
        <md-button ng-click="" class="md-primary">Save</md-button>



.controller('MyController', function($scope, $mdDialog) { = function(ev) {
    this.showText = false;
        templateUrl: "test.html",
        clickOutsideToClose: true,
        scope: $scope,
        preserveScope: true,
        controller: function($scope) {
  }; = function () {
    this.showText = true;