AngularJS ng-bind 没有更新
AngularJS ng-bind is not updating
<div class="btn-group dd-rm-action" role="group" aria-label="...">
<button type="button" class="btn btn-primary dd-action pagination-centered" ng-click="Save()">Save</button>
<button class="btn btn-default dd-action dropdown-toggle" type="button" id="dropdownState" data-toggle="dropdown" aria-expanded="true" ng-bind="rmCW.State.Name">
<b class="caret"></b>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownState">
<li role="presentation" ng-repeat="task in docState.Tasks">
<a role="menuitem" tabindex="{{$index}}" href="#" ng-click="execTask(task)">{{task.Name}}</a>
</li>
</ul>
</div>
我有一个 angularjs 应用程序 工作正常,只是按钮的 ng-bind
在我更新范围值后不会更新:
result.then(function (r) {
$scope.$emit('UNLOAD');
if (r.status == 0) {
var cs = JSON.parse(r.data)
$scope.docState = cs;
$scope.rmCW.Current = cs;
}
}
很可能是因为 ng-bind="rmCW.State.Name"
并且您的范围设置为其他 属性。
$scope.rmCW.Current = cs;
要么你需要将 ng-bind 设置为 ng-bind="rCW.Current.Name"
,要么你需要将 $scope 设置为 $scope.rmCW.State = cs;
<div class="btn-group dd-rm-action" role="group" aria-label="...">
<button type="button" class="btn btn-primary dd-action pagination-centered" ng-click="Save()">Save</button>
<button class="btn btn-default dd-action dropdown-toggle" type="button" id="dropdownState" data-toggle="dropdown" aria-expanded="true" ng-bind="rmCW.State.Name">
<b class="caret"></b>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownState">
<li role="presentation" ng-repeat="task in docState.Tasks">
<a role="menuitem" tabindex="{{$index}}" href="#" ng-click="execTask(task)">{{task.Name}}</a>
</li>
</ul>
</div>
我有一个 angularjs 应用程序 工作正常,只是按钮的 ng-bind
在我更新范围值后不会更新:
result.then(function (r) {
$scope.$emit('UNLOAD');
if (r.status == 0) {
var cs = JSON.parse(r.data)
$scope.docState = cs;
$scope.rmCW.Current = cs;
}
}
很可能是因为 ng-bind="rmCW.State.Name"
并且您的范围设置为其他 属性。
$scope.rmCW.Current = cs;
要么你需要将 ng-bind 设置为 ng-bind="rCW.Current.Name"
,要么你需要将 $scope 设置为 $scope.rmCW.State = cs;