I\'m trying to pass a form input to my dialog (as title for example). The problem is: it don\'t get the form $scope
.
If I set the $scope
si
You should pass in the task
object from the ng-repeat into the ng-click.
For ex ng-click="expandTask($event, task)"
and in your $mdDialog controller, you will have access to that object:
app.controller('tasksCtrl', ['$scope', '$mdDialog', function ($scope, $mdDialog) {
$scope.expandTask = function (e, task) {
//ng-click="expandTask($event, task)"
$mdDialog.show({
clickOutsideToClose: true,
controller: function ($mdDialog) {
var vm = this;
vm.task = {};
vm.task = task; //your task object from the ng-repeat
$scope.hide = function () {
$mdDialog.hide();
};
$scope.cancel = function () {
$mdDialog.cancel();
};
},
controllerAs: 'modal',
templateUrl: 'models/dialog.tmpl.php',
parent: angular.element(document.body),
targetEvent: e
});
};
}]);
And in modal template you will access the task object with controllerAs notation, for example:
{{ modal.task.name }}