0
I’m trying to get the input information and pass it to my controller scope but something is wrong and I couldn’t identify what it might be if someone could help thank you
<section class="container" id="citys" ng-controller="CtrlTypeProperties">
<script type="text/ng-template" id="modal-type-properties.html">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form action="" method="post">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Adicionar Tipo de Imóvel</h4>
</div>
<div class="modal-body">
<input type="text" class="form-control" ng-model="nameCity" name="name" placeholder="Cidade" />
</div>
<div class="modal-footer">
<button type="button" ng-click="cancel()" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
<button type="button" class="btn btn-primary" ng-click="add_type_properties()">Adicionar</button>
</div>
</form>
</div>
</div>
</script>
</section>
<script>
app.controller('CtrlTypeProperties', function($scope, $modal, $http){
$scope.open_modal = function (){
$modal.open({
templateUrl: 'modal-type-properties.html',
controller: 'ModalInstanceCtrl',
resolve: {
name: function () {
return $scope.nameCity;
}
}
});
}
});
app.controller('ModalInstanceCtrl', function ($scope, $modalInstance, name){
$scope.name = '';
console.log($scope.name);
$scope.add_type_properties = function () {
console.log($scope.name);
};
$scope.cancel = function () {
$modalInstance.dismiss('cancelado');
};
});
</script>
All I need is to take the input value and update the modal controller Scope
Thank you very much friend, I did several researches until I found this medium but as I’m still walking with the Angularjs I could not finish. It worked as I expected thank you even
– Alef Felipe