How to update the master page comment count after adding a comment in detail page?


#1

Hi,

This is the my master page :

HTML:

<div class="list" ng-repeat="data in timeline">
         {{data.commentCount}}
</div>

Controller:

app.controller('timelineCtrl', function ($scope) {
    $scope.timeline = [
            { commentCount: 2, postID: 1 },
            { commentCount: 2, postID: 2 },
            { commentCount: 3, postID: 3 }];
}

This is the detail page:
HTML:

<ion-nav-bar>
  <ion-nav-back-button >
  </ion-nav-back-button>
</ion-nav-bar>
<ion-content>
 <input ng-model="comment">
 <button ng-click="sendNewComment()"></button>
</ion-content>

Controller:

app.controller('commentCtrl', function ($scope) {
     $scope.comment ="";
     $scope.sendNewComment = function () {
             Azureservice.insert('Comments', {
                comment: comment,
            }).......
    }
}

So my question is how can I update the comment count in master page without refreshing after the user clicked <ion-nav-back-button > to go back to master page?

Thanks in advanced!!! I really need to get this to work: )