1
I’m not getting through $ctrl.close(data)
to the controller
who wears that component
:
uibModal that I’m using:
angular.module('sisApcd').component('buscaPessFis', {
templateUrl: 'app/components/buscaPessFis/pessFisBusca.html',
bindings: {
resolve: '<',
close: '&',
dismiss: '&'
},
/// Controller do Component de buscaPessFis
controller: function ($scope) {
var $ctrl = this;
$ctrl.$onInit = function () {
};
// Acoes click
$scope.ok = function (e) {
var valor = e.target.attributes['id-user'].value;
$ctrl.close({valor2: 'teste'});
};
$scope.cancel = function () {
$ctrl.dismiss({valor2: 'teste'});
};
}
});
Where it calls the component:
modalInstance.result.then(function (data) {
console.log(data);
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
And get back to me
Undefined
I was going to make an answer but I’m running out of time, but you need to use the
$modalInstance.close
, if using updated version is$uibModalInstance.close
, and to use you need to inject into the controllerfunction ($scope, $uibModalInstance) { ... }
– Pedro Camara Junior