-1
我想通过使用超时方法添加2000ms的延迟,但它不工作,如果我尝试在cotroller内的函数(searchfunc)中调用它。它给出了错误:$超时不是一个函数。 控制器代码:
var angularjsapp = angular.module('graphApp', ['ngAnimate', 'ui.bootstrap','ui.grid']);
angularjsapp.controller('AccordionDemoCtrl', function($scope, $timeout) {
$scope.searchfunc = function(search_name,$timeout) {
WebSocketTest(search_name,keyword_type);
//$scope.loading = false;
$timeout(function() {
$scope.loading = false;
}, 2000);
});