gpt4 book ai didi

javascript - 如何修复此 $scope 以在 HTML 中显示

转载 作者:行者123 更新时间:2023-12-03 09:01:22 25 4
gpt4 key购买 nike

我的函数中有 $scope 但这个 $scope 无法在 html 中显示如何使其显示?

this code in fucntion

$scope.checkBrach = function(index) {
console.log($scope.dataBranch[index]);
$scope.branchCode = $scope.dataBranch[index].branch_code;
}

this code in HTML and {{branchCode}} dont show data for me

× รายชื่อสาขา 选择 {{i.branch_code}} {{i.branch_name}} build 删除 关闭 好的

<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">&times;</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>

最佳答案

为了设置 $scope.branchCode 的值,您必须运行函数 $scope.checkBrach,因为范围变量branchCode 是在该函数内部创建的,或者您可以在 Controller 顶部定义变量,例如 $scope.branchCode = "xyzbranch code"

关于javascript - 如何修复此 $scope 以在 HTML 中显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32293355/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com