- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在 Controller 中使用$timeout
,但它不起作用!
app.controller("Friendsrequests",['$http','$log','$location','$timeout','$scope', function($http,$log,$location,$timeout,$scope){
//getting base url of application
this.baseUrl = function() {
var base_url = window.location.origin;
var pathArray = window.location.pathname;
return base_url;
// return base_url+pathArray;
};
// assigning to a variablebase_url('login/f_request');
var ThroughUrl = this.baseUrl()+'/keon/login/f_request';
//declare a variable
var ata = this;
ata.notifications = [ ] ;
ata.counts=' ';
//sending ajax request
function getNotifications()
{
$http({method: 'POST', url: ThroughUrl,})
.success(function(data) {
// this callback will be called asynchronously
// when the response is available
//assign data to the variable
ata.notifications=data;
ata.counts =data.length;
}).
error(function(data, status, headers, config) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
}
$timeout(function() {
getNotifications();
}, 1000);
}]);
最佳答案
已更新
直接替换即可
$timeout(function() {
getNotifications();
}, 1000);
与
$interval(function() {
getNotifications();
},1000);
关于javascript - $timeout 在 angular.js 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26180401/
我正在使用 heroku 来托管支持 iOS 应用程序的 ruby on rails 应用程序。我有一个可能会运行很长时间的请求,我需要能够在我的请求被终止之前捕获超时。我正在使用 Timeout
我在 https://stackoverflow.com/questions/517219?tab=oldest#tab-top 找到了我认为应该完美运行的东西但是,它对我不起作用。 我在 Windo
我有这段代码: begin complete_results = Timeout.timeout(4) do results = platform.search(artist,
我正在开发一个音乐训练游戏,我使用 Unity 3D 来创建它。 它会发出随机音符。 问题是,我的 android 设备只有五个“屏幕熄灭前的时间”选项,其中最长的是 10 分钟。 所以 10 分钟后
我运行以下代码来捕获任何可能挂起的 SQL 语句。在尝试对此进行测试时,我编写了一个非常优化的 sql 语句,它需要一分钟的时间才能运行。我在 activerecord execute sql 语句周
由于 Faraday 没有文档,我无法在任何地方找到它。法拉第什么是“timeout”,什么是“open timeout”? 最佳答案 如果您在 https://github.com/lostisla
我想对 Angular.js $timeout 进行单元测试,以检查是否已使用正确的持续时间/延迟值调用它。 断言看起来像这样: expect($timeout).toHaveBeenCalledWi
我正在循环一个列表并对列表中的每个成员执行一些操作。如果某个成员花费了太多时间(在本例中为 1 秒),我打算跳过它。但是,try 语句内的 block 始终处于处理状态,并且永远不会超时。我不明白为什
我有一个程序可以打印出通过或失败。我想检测卡在那里的程序并回显“超时” 我写了这样一个脚本: #!/bin/bash echo -n 'test' && timeout 5 ./mytest | gr
我有一个 Sinatra 应用程序。我正在使用 Rack::Test 对其进行测试。我想确保将查询字符串参数传递给 Timeout::timeout()。 我认为 expect_any_instanc
相同的脚本不同的错误。这可能更多地与我的网络有关,而不是我的代码。脚本如下: #!/usr/bin/env ruby -rubygems require File.join(File.dirname(
我需要测试一个从 url 加载图像的 AngularJs 服务。这是我的服务: /*global angular, Image*/ (function () { 'use strict'; f
随着数据库大小的增加,我有一个查询需要更长的时间来执行。查询已优化并且是必要的,但我的 C# 控制台应用程序最近给我这个错误: Unhandled Exception: MySql.Data.MySq
我正在研究 Linux shell 中的 timeout 命令。 当我尝试 timeout 1 bash 时,bash 将运行并在 1 秒后终止。 当我尝试 timeout 2 timeout 1 y
随着数据库大小的增加,我有一个查询需要更长的时间来执行。查询已优化并且是必要的,但我的 C# 控制台应用程序最近给我这个错误: Unhandled Exception: MySql.Data.MySq
我希望使用 Spring boot 和 Tomcat 扩展 Spring MVC 应用程序中的用户 session 。查看文档似乎有 2 个相关 properties : server.servlet
我正在尝试升级 Puppet 以使用 Ruby 1.9,但遇到了常量问题。 const_defined?("Timeout") 返回真,即使 :Timeout 不在常量列表中。这不会发生在 Ruby
首先,这是一个几乎重复的: How to differentiate when wait(long timeout) exit for notify or timeout? 但这是一个新的后续问题。
对于下面的代码,notifyAll() 会一直持有锁直到完成,即使超时了,这个 block 也不持有锁,必须等待notifyAll() block 完成。那么wait(timeout)中的timeou
Thread.Sleep(timeout) 和resetEvent.Wait(timeout) 都会导致执行暂停至少timeout 毫秒,那么它们之间有区别吗?我知道 Thread.Sleep 导致线
我是一名优秀的程序员,十分优秀!