-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);
});