I can't figure out how to call a directive from within a modal created with the $dialog service. That directive should also be able to see the buttons on the modal and override their ng-click action.
Here's my modal template:
<div class="modal-header">
<h1>Rechercher</h1>
</div>
<div class="modal-body">
<search-person></search-person>
</div>
<div class="modal-footer">
<button ng-click="close(result)" class="btn btn-primary">Close</button>
</div>
the searchPerson directive template:
<span>{{test}}</span>
the searchPerson directive itself:
angular.module('person.directives').directive("searchPerson", ['PersonService', function (PersonService) {
return {
restrict: "E",
templateUrl: "person/views/searchPerson.html",
scope: {},
controller: 'searchPersonCtrl'
}
}]);
the searchPerson controller:
angular.module('person.controllers').controller('searchPersonCtrl', ['$scope', function ($scope) {
$scope.test = 2;
}]);
and finally the modal controller:
angular.module('person.controllers').controller('DialogController', ['$scope', 'dialog', function($scope, dialog) {
$scope.test = 2;
$scope.close = function (result) {
alert('modal scope');
dialog.close($scope.test);
};
}]);
So how do I make the searchPerson controller and the modal controller communicate with each other ?