我具有notifications.get()
每10秒运行一次的功能。
function notificationsCtrl($scope, $interval) {
$interval(function(){
$scope.notification = notifications.get();
$('.card').addClass('rotate');
}, 10000);
};
但是,在加载页面时,应立即调用该函数一次。谁能帮我?
你可以这样
$interval()
每10秒执行一次。码:
function notificationsCtrl($scope, $interval) {
var fun = function(){
$scope.notification = notifications.get();
$('.card').addClass('rotate');
};
fun();
$interval(fun, 10000);
};
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句