I have the following list structure:
<div style="position: fixed;z-index: 999;top:20%;margin:0 auto;left:25%;width:50%;padding:5%;background:#FFF;" ng-if="templateForm == 'light-box-selectcasa'">
<div class="col-md-12">
<label>SELECIONE UMA CASA PARA LISTAR AS INFORMAÇÕES</label>
<select class="form-control" ng-options="item as item.referencia for item in casas.list track by item.id" ng-model="obj.casa"></select>
</div>
<div class="col-md-12">
<br/>
<button class="btn btn-block btn-primary" ng-click="setCasa()">SELECIONAR CASA</button>
</div>
<div style="position:fixed;width:1px;height:1px;float:left;"><img style="position:relative;float:left;right:190px;bottom:50px;" src="<?= base_url('assets/img/man-calendar.png') ?>"/></div>
</div>
The listing is correct, lists the items in the database, and so on.
And then I have the function inside the angular, setCasa ():
var casaRef = '';
app.controller("agendaController", function ($scope, $http, $timeout) {
$scope.setCasa = function () {
casaRef = $scope.obj.casa;
$scope.template = '';
$scope.templateForm = '';
};
}
But when for the action of setCasa, if I give an alert at homeRef, it only comes with [object Object].
How to pass this variable so that when I give the alert, then what is selected?