我在功能上有$ scope但这个$ scope不能在html中显示如何让它显示?
这个代码在fucntion
$scope.checkBrach = function(index) {
console.log($scope.dataBranch[index]);
$scope.branchCode = $scope.dataBranch[index].branch_code;
}
× รายชื่อสาขา 选择 {{i.branch_code}} {{i.branch_name}} 建立 删除 关 好HTML中的代码和{{branchCode}}不为我显示数据
<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>
答案 0 :(得分:1)
为了设置$scope.branchCode
的值,您必须运行函数$scope.checkBrach
,因为范围变量branchCode是在该函数内创建的,或者您可以在控制器顶部定义变量,如{ {1}}。