angularjs负载状态承诺

时间:2014-08-01 07:06:52

标签: javascript angularjs

我创建了工厂,我在控制器中加载数据。我想创建加载数据的状态,就像正常的文本状态一样。我该怎么办?

var myApp = angular.module('myApp',[]);

            myApp.controller('aukcjeController',function($scope,auctionFactory){
                $scope.Data={};


                $scope.get= function (data) {
                    auctionFactory.getOrders(data)
                    //somethink here ???
                    .progres(function(orders,status){
                    $scope.status = status
                     })
                     //???
                    .success(function (orders) {
                        $scope.Data= orders;
                        console.log($scope.Data);
                        $scope.dataLoaded=true;
                    })
                    .error(function (error) {
                        console.log(error);
                    });
                };
//                get();
            });

            myApp.factory('auctionFactory',function($http){
                var fac = {};

                fac.getOrders = function () {
                    return $http.get('file.php',{ cache: true});
                };
                return fac;
            });

0 个答案:

没有答案