Reputation: 53
i have $scope in function but this $scope cant show in html How To make it show ?
this code in fucntion
$scope.checkBrach = function(index) {
console.log($scope.dataBranch[index]);
$scope.branchCode = $scope.dataBranch[index].branch_code;
}
× รายชื่อสาขา choose {{i.branch_code}} {{i.branch_name}} build delete Close OKthis code in HTML and {{branchCode}} dont show data for me
<div aria-hidden="true" class="modal fade" id="delete-branch" role="dialog" tabindex="-1" ng-controller="contestCtrl">
<div class="modal-dialog modal-xs">
<div class="modal-content">
<div class="modal-heading">
<a class="modal-close" data-dismiss="modal">×</a>
<h2 class="modal-title">Modal Title</h2>
</div>
<div class="modal-inner">
<p>
<strong>{{branchCode}}</strong>
</p>
</div>
<div class="modal-footer">
<p class="text-right">
<button class="btn btn-flat btn-alt" data-dismiss="modal" type="button">Close</button>
<button class="btn btn-flat btn-alt" data-dismiss="modal" type="button">OK</button>
</p>
</div>
</div>
</div>
</div>
Upvotes: 0
Views: 72
Reputation: 26
In order to set the value for $scope.branchCode
you must run the function $scope.checkBrach
because the scope variable branchCode is being created inside that function or you could define your variable at the top of your controller like $scope.branchCode = "xyz branch code"
.
Upvotes: 1