如何在POST数据后增加计数?

时间:2017-05-23 20:45:45

标签: php mysql angularjs

我的angularjs应用程序。当我向数据库filtered.length添加记录时应该增加。

的index.html

<li id="notification_li">
    <div  ng-init="initFirst(o)" ng-model="o.order_date" ng-repeat="order in filtered = (o|getOrders)" ng-show="filtered.length > 0" ></div>
        <span  id="notification_count" ng-if="filtered.length > 0">
            {{ filtered.length }}
        </span>
    </div>
</li>

app.js

app.controller('MainCtrl', ['$scope', '$http', '$filter', '$location', 'timeline', 'o', 'routeChecker', 'breadcrumbs', function($scope, $http, $filter, $location, timeline, o, routeChecker, breadcrumbs){
    $scope.routeChecker = routeChecker;
    $scope.breadcrumbs = breadcrumbs;

    $scope.timelineEvent = {};      
    $scope.o = [];  
    $scope.init = [];   
    $scope.timeline = [];

    $scope.timelineEvent.contact_date = $filter("date")(Date.now(), 'yyyy-MM-dd');      

    o.getO(function (o) {           
        $scope.o = o;
});

$scope.setSelected = function(o) {
    $location.path("/clients/" + o.client_id);  
};

$scope.initFirst = function(o) {
    $http.get('/api.php/contact-timeline')
     .success(function(o) {
        $scope.o = o;

    })
  };        
}])

它可以工作,但页面加载很长。有什么建议吗?

0 个答案:

没有答案