Issue with one way binding for re-render data in ng-repeat

17 views
Skip to first unread message

mseth...@apptivo.co.in

unread,
Apr 23, 2015, 10:43:20 AM4/23/15
to ang...@googlegroups.com
Hi All,

        I am using one way binding in ng-repeat. still i want to refresh the ng-repeat when the array value is changed. please suggest with your ideas
Refer the below plunker URL .

http://plnkr.co/edit/YU3dSLHD7AachnzpeGIR?p=preview

   Example
       
<html ng-app="todoApp">
  <head>
    <title>
      TO DO List
  </title>
  <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootswatch/3.1.1/readable/bootstrap.min.css">
  <link rel="stylesheet" href="style.css">
  <script data-require="angular.js@*" data-semver="1.3.1" src="//code.angularjs.org/1.3.1/angular.js">
  </script>
  <script>
   
 var todoApp = angular.module("todoApp", []).config(function($compileProvider, $httpProvider) {
     $compileProvider.debugInfoEnabled(true);
 });

 todoApp.controller("ToDoCtrl", function($scope) {

     $scope.data = [12, 23, 45, 67, 89];
     $scope.add = function(dtata) {
         $scope.data.push(dtata);
     }
 });
   
  </script>
 
  </head>
  <body ng-controller="ToDoCtrl">
   
    <!-- ...elements omitted for brevity... -->
 
  <div class="panel">
    <div class="input-group">
      <input class="form-control" />
      <input type="text" ng-model="numberData"/>
      <button type="submit" ng-click="add(numberData)">
        add
      </button>
    </div>
    <table class="table table-striped">
      <thead>
        <tr>
          <th >
            Numbers
          </th>
        </tr>
        <tr ng-repeat="de in ::data">
          <th >
            {{::de}}
          </th>
        </tr>

      </thead>
      <tbody>
      </tbody>
    </table>
  </div>
  </body>
</html>


      

Reply all
Reply to author
Forward
0 new messages