app.controller('StdMaterialCtrl', [ '$rootScope', '$scope', function($rootScope, $scope) { $scope.getMaterialArray = function(){ $rootScope.ajaxRequest({ url : '../enrol/std/material/all.htm' }, function(response) { $scope.materialArray = response.array; }); } $scope.getMaterialArray(); $scope.showMaterial = function(m){ // 没有上传或者审核失败 if(m.material_id == undefined || m.verify_status == 'InActive') { $rootScope.uploadStdMaterial(m.material_type,function(){ $scope.getMaterialArray(); }); }else { $rootScope.goLocation('std/material_info/' + m.material_id ); } } } ])