Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Ionic Ion-List is Not Updating After Item is Being Added

$
0
0

@azamsharp wrote:

I am trying to add a new item to the Ion-List and for some reason it never refresh to update the list:

.controller("HomeController",function($scope,$ionicModal,$state){

    $scope.windows = [{id : 1,title:"hello"}];

    $scope.addNewWindow = function(window) {
      // assign a new id to the window
      $scope.windows.push(window);
      // close the modal
      $scope.closeAddNewWindowModal();
    }

I have debugged it and $scope.windows is updated and it does show multiple items But for some reason the ion-list is never updated.

Here is the Index.html code:

<body ng-app="starter" ng-controller="HomeController">

    <ion-pane>
      <ion-header-bar class="bar-positive">
        <h1 class="title">MI</h1>

        <div class="buttons">
          <button ng-click="openAddNewWindowModal()" class="button">Add New Window</button>
        </div>
      </ion-header-bar>

      <ion-nav-view class="has-header"></ion-nav-view>

    </ion-pane>

  </body>

list.html looks like this:

<ion-list>
  <ion-item ui-sref="window-details" ng-repeat="window in windows">
    {{window.title}}
  </ion-item>
</ion-list>

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>