angularjs范围变量未在视图中更新

时间:2018-04-26 10:16:48

标签: angularjs

<ul class="inProgressProjList" ng-if= "selectBanksDetails.length > 0">
                <li  ng-repeat="selectBanksDetails in selectBanksDetails ">
...

如果我更改selectBanksDetails(如覆盖它),这是控制器中的范围变量,那么在提到的列表中不会打印任何内容。

1 个答案:

答案 0 :(得分:1)

在这里,我假设您想要做这样的事情

http://jsfiddle.net/fuxhhLep/

HTML

<div ng-app="helloApp" ng-controller="helloCtrl">
  <p>Name:
    <input type="text" placeholder="your name" ng-model="myName" ng-change=Data()>
  </p>
  <h1>Hello {{myNam}}</h1>

  <h2>{{updated_info}}</h2>

JS

var app = angular.module("helloApp", []);
app.controller("helloCtrl", function($scope) {
  $scope.myName = 6;
  $scope.myNam = $scope.myName;
  $scope.Data = function() {
    $scope.updated_info = angular.copy($scope.myName);

  }
});