Reputation: 1182
Here's the sample http://codepen.io/anon/pen/ZWrNGW.
<body layout="column" ng-controller="AppCtrl">
<script type="text/ng-template" id="save-dialog.tmpl.html">
<md-dialog>{{message}}</md-dialog>
</script>
<md-button ng-click="showDialog()">
Show Dialog</md-button>
</body>
Controller
angular.module('playground', ['ngMaterial'])
.controller('AppCtrl', function($scope, $mdDialog) {
$scope.showDialog = function() {
$mdDialog.show({templateUrl: 'save-dialog.tmpl.html'})
};
$scope.message = 'This message should idsplay on dialog';
});
Angular expression for {{message}} doesn't evaluate for text/ng-template on click of "Show Dialog" button even though its defined in the scope.
Please help me with this
Upvotes: 1
Views: 303
Reputation: 134
You need to add the scope to the opening of the dialog:
$mdDialog.show({
templateUrl: 'save-dialog.tmpl.html',
scope: $scope
})
Upvotes: 0