Angular.js view doesn't update when nested $scope array is updated

后端 未结 4 1611
借酒劲吻你
借酒劲吻你 2020-12-16 16:31

I am trying to make an angular.js view update itself when adding a comment. My code is as follows:

相关标签:
4条回答
  • 2020-12-16 17:18

    Modify the code to wrap inside scope.$apply because you are modifying the property outside the angular scope you have to use scope.$apply() to watch the values

    0 讨论(0)
  • 2020-12-16 17:25

    I had to place my form inside the same div controller as the ng-repeat. I had two separate div controllers.

    0 讨论(0)
  • 2020-12-16 17:29

    Use $scope.$parent.arrayObjet to modify the parent variables instead of $scope.arryaObject. It worked in my case.

    0 讨论(0)
  • 2020-12-16 17:32
    <div class="col-sm-12 col-lg-12">
                <div class="outer-container">
                    <div class="inner-container">
                        <div class="table-header">
                            <form id="teamForm" name="teamForm">
                                <table class="table table-bordered">
                                    <thead>
    
                                    <!-- Grid header -->
                                    <tbody data-ng-if="(allTeamMembers.length==0)">
                                        <tr>
                                            <td class="text-center height_33_p" colspan="15"> {{noResultFound}} </td>
                                        </tr>
                                    </tbody>
                                    <!-- Existing team member -->
    
                                    <tbody data-ng-repeat="tm in teammemberDetailsArryobject|orderBy:orderByField:reverseSort" data-ng-form="innerForm_$index" data-ng-class="{'ng-submitted':innerForm_$index.$submitted}">
                                        <tr></tr>
                                        </tbody>
    

    In the code I am deleting one record and add new row programmatically but all the rows are displayed in the ng-repeat rows(including deleted)

    0 讨论(0)
提交回复
热议问题