返回在AngularJS中返回null

时间:2015-04-04 21:00:44

标签: javascript angularjs return

嗯,案例是我尝试在Angular-JS中运行一个函数来调用一个文件,获取一条信息,然后我将其返回,但是为了更多,我尝试我总是返回相同的< / p>

以下

中的功能
$scope.getDate = function (value) {
    var time = 0;
    $http({
        method: 'GET',
        url: 'mock/build-'+value+'.xml',
        headers: {
            Authorization: 'Basic OjM5NzI1MTkwMzM0Njg3NTM4ODY='
        }
    }).success(function (data,status) {
        $scope.buildAlt = new X2JS().xml_str2json(data);
        var auxiliary = angular.fromJson($scope.buildAlt);
        time = auxiliary.build.finishDate;
        console.log('BuildName : ' + auxiliary.build._buildTypeId);
        console.log('Time : ' + time);
    //    $scope.getError(status,'build',value);
    //    $scope.testing.push(time);
    //    console.log($scope.testing);
    }).error(function (data,status) {
        $scope.testing.push('');
        //$scope.getError(status,'build',value);
    }); 
    return time;
};

我运行的HTML:

            <div class="update-container col-xs-12">
            <time ng-repeat="index in build"> <!--ng-if="index._id == values._id"-->
                <!--<i>{{index.finishDate | date:'shortDate'}}</i>-->
                <i ng-init="updateDate = (getDate(values._id))">{{updateDate}}</i>
            </time>
            <div class="status-container" ng-repeat="buildsData in builds">
                <div class="status glyphicon" ng-repeat="buildStatus in buildsData.build | orderBy:'_id'"
                     ng-if="buildStatus._buildTypeId == values._buildTypeId"
                     ng-class="{'glyphicon-ok': buildStatus._status=='SUCCESS','glyphicon-remove': buildStatus._status=='FAILURE','glyphicon-minus': buildStatus._status=='cancel'}"></div>
            </div>
        </div>

0 个答案:

没有答案