草庐IT

http-error

全部标签

javascript - 如何使用(this)访问Angular 2 http rxjs catch函数中的对象属性

在Angular2中使用新的http服务,我想对我的错误做更多的事情,而不仅仅是在控制台中抛出错误。不幸的是,我似乎无法从catch回调函数中访问我的对象属性。我的http服务调用:returnthis.http.get(this.apiUrl,options).map(this.extractData,this).catch(this.handleError)我的handleError回调fn:handleError(error){console.log(this)//undefined!if(error.status===401){this.router.navigate(['/l

javascript - 为什么 Angular 5 Transition 抛出 AppComponent.html :2 ERROR TypeError: Cannot read property 'forEach' of undefined

为什么Angular5会抛出这个错误?AppComponent.html:2ERRORTypeError:Cannotreadproperty'forEach'ofundefined我正在研究Angular动画的概念验证,我直接使用网站上的代码。我的组件如下所示:import{Component,OnInit}from'@angular/core';import{trigger,state,style,transition,animate,keyframes}from'@angular/animations';@Component({selector:'app-obj-list',te

javascript - 如何将 apollo-link-http 与 apollo-upload-client 一起使用?

我正在尝试弄清楚如何使用apollo-link-http与apollo-upload-client.两者都创建了一个终止链接,但我怎么能同时使用这两个链接呢?在我的index.js中我有这样的,但它不会工作,因为两个链接都终止=>constuploadLink=createUploadLink({uri:process.env.REACT_APP_GRAPHQL_URL});consthttpLink=newHttpLink({uri:process.env.REACT_APP_GRAPHQL_URL});constclient=newApolloClient({link:Apollo

开放层中的 Javascript "unspecified error"

我收到此错误alttexthttp://img239.imageshack.us/img239/6936/jserror.png本地图加载时。错误出在原始的、未修改的OpenLayers.js文件中这一行:return!!(document.namespaces);我尝试将其重写为:return(typeof(document.namespaces)!='undefined');它起作用了,但随后我在进一步引用document.namespaces时遇到相同的“未指定”错误:if(!document.namespaces.olv){document.namespaces.add("ol

javascript - 无法使用 AngularJS 显式 `$http` 语法注入(inject) `app.controller`?

我有beentold我应该使用app.controller语法,以支持缩小。重写示例(教程)示例,我发现我无法让它工作:use'strict';/*Minifiablesolution;whichdoesn'twork*/varapp=angular.module('myApp',['ngGrid']);//phones.json:http://angular.github.io/angular-phonecat/step-5/app/phones/phones.jsonapp.controller('PhoneListCtrl',['$scope','$http',function(

javascript - CSSLint : How to config tasks just print error not warning

我是Grunt-csslint插件的新手,在我运行cssLint任务完成后,有很多错误和警告我无法跟进。那么如何配置任务只打印出错误,而不是警告?? 最佳答案 如果您使用grunt-contrib-csslint您可以在.csslintrc文件中指定选项。来自grunt-contrib-csslint自述文件:OptionsAnyspecifiedoptionwillbepassedthroughdirectlytocsslint,thusyoucanspecifyanyoptionthatcsslintsupports.Thecs

javascript - AngularJS fn is not a function error using $timeout with a function with parameters 错误

我正在制作一个您可以编辑文本的网页,在您停止输入1秒后,它会自动保存您输入的内容。目前我正在研究$timeout的细节。当我调用没有参数的update方法时,它可以正常工作,但是当我使用参数调用它时,我得到错误:Error:fnisnotafunction$TimeoutProvider/this.$get为什么我在执行以下操作时会收到此错误:timeout=$timeout(update(element,content),1000);但不是当我这样做的时候:timeout=$timeout(update,1000);显然我需要将参数传递给更新方法,因为我需要知道要更新什么。debou

javascript - 什么将解决 WebDriverError : Connection refused error message?

我无法在本地运行Protractor测试,几天前我可以,但现在我不能。我什至重新启动了Ubuntu。这是我的版本:$cat/etc/issueUbuntu14.04.5$node--versionv6.8.0$npmlist-g|grepprotractor└─┬protractor@4.0.9$webdriver-managerstatus[13:49:58]I/status-seleniumstandaloneversionavailable:2.53.1[default][13:49:58]I/status-chromedriverversionavailable:2.22[de

javascript - Node.js websocket 错误 "Error: listen EADDRNOTAVAIL Error: listen EADDRNOTAVAIL"

应用程序在本地主机上工作正常。但是当它连接到服务器时出现错误。我通过端口22连接服务器这是错误Error:listenEADDRNOTAVAILError:listenEADDRNOTAVAILaterrnoException(net.js:904:11)atServer._listen2(net.js:1023:19)atlisten(net.js:1064:10)atnet.js:1146:9atdns.js:72:18atprocess._tickCallback(node.js:419:13)atFunction.Module.runMain(module.js:499:11)

javascript - 在Node.Js Express中, "res.render"是否结束http请求?

所以,只有在您确定一切都已完成时才执行“res.render”,对吗?因为它结束了请求并弹出了一个网页。 最佳答案 如果您不提供对res.render(view[,options[,fn]])的回调,它将自动给出一个带有200HTTPStatus和Content-Type的响应:text/htmlres.render('view',{},function(){while(true);//shouldblock});res.render(view[,options[,fn]])Renderviewwiththegivenoptions