AngularJS ng repeat在模型更改后不刷新$rootScope错误

AngularJS ng repeat在模型更改后不刷新$rootScope错误,angularjs,angularjs-ng-repeat,rootscope,Angularjs,Angularjs Ng Repeat,Rootscope,AngularJS的成员们好,我是AngularJS的新手,我面临着这样的问题:我的ng repeat在模型更改后不会刷新页面,即使我已经在发布后手动重新加载了模型。我创建的所有函数都可以完美地工作,因为我可以在数据库端存储数据/删除,除非我手动单击F5,否则它不会在页面刷新时执行。这是我在js方面的方法 'use strict'; var eXcomments = angular.module('eXcomments', ['ngAnimate']); eXcomments.controlle

AngularJS的成员们好,我是AngularJS的新手,我面临着这样的问题:我的ng repeat在模型更改后不会刷新页面,即使我已经在发布后手动重新加载了模型。我创建的所有函数都可以完美地工作,因为我可以在数据库端存储数据/删除,除非我手动单击F5,否则它不会在页面刷新时执行。这是我在js方面的方法

'use strict';
var eXcomments = angular.module('eXcomments', ['ngAnimate']);
eXcomments.controller('eXcommentsCtrl', function($scope, $http){

$scope.comments;
$scope.inputcomment;

$scope.getComments = function(topic_id){
    $http.get('index.php?r=exploreComment/WS_getExploreComments&topic_id=' + topic_id, {cache:false}).success(function(data){
        $scope.comments = data;
        console.log($scope.comments);
        console.log('Comment Loaded');
    });
};


$scope.init = function(topic_id){
    $scope.getComments(topic_id);
};

$scope.post = function(topic_id){
    $scope.getComments(topic_id);
    console.log('Reload Comment Success');
};


$scope.makePost = function(topic_id, user_id){

    var formatJSON = {
            user_id: user_id,
            topic_id: topic_id,
            data: escape($scope.inputcomment),
    };
    var json = JSON.stringify(formatJSON);
    $http.post('index.php?r=exploreComment/WS_PostComment&json=' + json);   
    console.log(json);
    console.log('posted');
    $scope.inputcomment = "";

    $scope.getComments(topic_id); 
    console.log('Reload Comment Success');
};

$scope.removePost = function(topic_id, comment_id){

    $http.post('index.php?r=exploreComment/WS_deleteComment&cid=' + comment_id);
    $scope.getComments(topic_id);
    console.log('Delete');
    console.log('Reload Comment Success');
    $scope.$apply('comments="null"');
};

});
我已经为不同的页面处理创建了单独的模块,然后像这样将其注入根应用程序

var myapps = angular.module('myapps',['customDirectives','imgGall','starApp', 'NavBarModel', 'Carousel', 'eXcomments','confirmButton','Status']);
这就是我的HTML布局的样子

<html>
<!-- Layouts for Comment Display -->
</html>
<div ng-controller="eXcommentsCtrl"
ng-init="init(<?php echo $topic_id?>)" ng-model="comments">
<div class="exploreNoCommentBlock" ng-if="comments.length == 0">
    <h4 style="text-align: center">No Comments Yet... How about leaving
        yours above?</h4>
</div>

<div class="exploreCommentBlock" ng-repeat="comment in comments">
    <table style="width: 100%">
        <tr style="width: 100%">

            <td style="width: 5%" rowspan="2" valign="top"><img
                src="<?php echo UrlMgmt::getUserResourceUrl()?>{{comment.user_id}}/avatar/{{comment.avatar}}"
                , style='height: 64px; width: 64px; border-radius: 5px;' /></td>



            <td style="width: 70%"><span class="author_name">{{comment.username}}</span>

AND----SO----ON


我猜这与html页面中的php代码有关。Angular适用于客户端单页应用程序,这些应用程序不会重新加载,因此不会运行php部件。这个php页面是模板/部分/视图还是您的主页?
TypeError: undefined is not a function
at Object.h [as fn] (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:140:152)
at k.$digest (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:109:352)
at k.$apply (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:112:345)
at HTMLDivElement.j (http://localhost/viralenz/themes/viralenz/js/ui-bootstrap-0.11.0.min.js:8:1779)
at HTMLDivElement.jQuery.event.dispatch (http://localhost/viralenz/assets/4483d5da/jquery.js:3058:9)
at HTMLDivElement.elemData.handle.eventHandle (http://localhost/viralenz/assets/4483d5da/jquery.js:2676:46) 


Error: [$rootScope:inprog] http://errors.angularjs.org/1.2.22/$rootScope/inprog?p0=%24apply
at Error (native)
at http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:6:450
at m (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:105:34)
at k.$apply (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:112:276)
at k.$scope.removePost (http://localhost/viralenz/themes/viralenz/js/ng.js:395:10)
at http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:176:387
at N.(anonymous function) (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:53:175)
at k.$eval (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:112:15)
at k.$apply (http://localhost/viralenz/themes/viralenz/js/angular-1.2.22/angular.min.js:112:293)
at HTMLButtonElement.<anonymous> (http://localhost/viralenz/themes/viralenz/js/ng.js:103:27)