草庐IT

request_method

全部标签

javascript - handlebars.js 未捕获类型错误 : Object #<Object> has no method 'call'

有人帮忙解决handlebars.js的问题吗?我正在使用在Centos6.4上运行的handlesbars预编译模板。要安装这个,我安装了:npm:yum-y--enablerepo=epelinstallnpm首先继承以避免问题:npminstall-ginherits然后是Handlebars本身:npminstall-ghandlebars这给出了以下版本:handlebars@2.0.0-alpha.1/usr/lib/node_modules/handlebars乐观主义者@0.3.7(wordwrap@0.0.2)uglify-js@2.3.6(async@0.2.10,

javascript - 从 Meteor.method 中的回调返回值

我遇到了一些我不了解Meteor的问题。我有这个方法,它接受一个查询,将它发送到亚马逊,然后在该函数的回调中我尝试返回结果。Meteor.methods({'search':function(query){varbookInfo;if(Meteor.isServer){amazon.execute('ItemSearch',{'SearchIndex':'Books','Keywords':query,'ResponseGroup':'ItemAttributes'},function(results){bookInfo=results;console.log(bookInfo);re

javascript - Firebase:错误解析触发器:找不到模块 'request-promise' 简单的云功能

想要为移动网站实现仅使用Firebase的方法,所以我决定为我的应用创建一个简单的API网关,这样我就可以调用云函数端点,而不是调用我的外部API并公开我的APIkey。我遵循了简单的helloworld示例并且没问题。一旦我按照Google示例(来自翻译和url缩短示例)中的说明添加了请求promise模块,我就无法继续。因为这个出现了。Errorparsingtriggers:Cannotfindmodule'request-promise'使用“请求”模块进行测试,结果相同。我的index.js真的很简单constfunctions=require('firebase-funct

javascript - 上传中的 "Error calling method on NPObject!"

我正在使用Uploadify在我的CMS中上传文件。一切正常,直到最近。我得到一个错误在NPObject上调用方法时出错在这条线上document.getElementById(jQuery(this).attr('id')+'Uploader').startFileUpload(ID,checkComplete);关于这部分uploadifyUpload:function(ID,checkComplete){jQuery(this).each(function(){if(!checkComplete)checkComplete=false;document.getElementByI

javascript - meteor JS : How to stub validated method in unit test

我正在使用经过验证的方法(mdg:validated-method)和LoggedInMixin(tunifight:loggedin-mixin)。现在我的单元测试出现了问题,因为它们因notLogged错误而失败,因为在单元测试中当然没有登录用户。我怎么必须stub呢?方法constresetEdit=newValidatedMethod({name:'reset',mixins:[LoggedInMixin],checkLoggedInError:{error:'notLogged'},//单元测试describe('resetEdit',()=>{it('shouldreset

javascript - 服务器响应 500 错误时触发 XMLHttp Request .upload.onprogress

我使用XMLHttp​Request上传文件。如果服务器响应错误消息500,我会尝试在onprogress事件之前处理错误消息。XMLHttpRequestconstxhr=newXMLHttpRequest();xhr.onreadystatechange=function(oEvent){if(xhr.readyState===4){if(xhr.status===500){console.log('error2');}}};xhr.onload=function(){if(this.status==200){console.log('success');}};xhr.upload

javascript - AngularJS : Should service's boolean method return promise that resolves to true/false, 或者被解决/拒绝?

promise的使用模式仍然让我感到困惑。例如,在Angular应用程序中,我有一个服务usersService,方法是emailExists(email)。显然,它向服务器请求检查给定的电子邮件是否已经存在。让方法emailExists(email)返回在正常操作中解析为true或false的promise对我来说感觉很自然.如果只是我们有一些意外的错误(比如,服务器返回500:内部服务器错误,那么promise应该被拒绝,但在正常操作中,它被解析为相应的bool值。然而,当我开始实现我的异步验证器指令(通过$asyncValidators)时,我看到它想要解决/拒绝promise。

javascript - 如何使用 Node 检查器跟踪 req.session 变量以了解如何从 request.session 中删除 session 对象

//Initializingsessionapp.use(session({secret:'keyboardcat',resave:true,saveUninitialized:true//cookie:{secure:true}}));我在创建购物车时遇到了一个问题,我在session中设置了购物车对象req.session.cart=[];//然后req.session.cart.push({title:p.title,price:p.price,image:'/static/Product_images/'+p._id+'/'+p.image,quantity:quantity,

javascript - Angular 和 Observable : how to avoid multiple requests to API within a given time

我在Angular4应用程序中有类似的东西(为了示例,我删除了代码)@Injectable()exportclassSomeService{constructor(privatehttp:Http){}get(id:number){returnthis.http.get('http://somedomain/somemodel/${id}.json');}}一些组件使用它来进行API调用。constructor(privatesomeService:SomeService){}...someMethod(){//codehere...this.someService.get(2).su

javascript - 如何解决 “cannot call method … of undefined” 错误?

functioncalcRoute(){varstart=document.getElementById("start_").value;varend=document.getElementById("end_").value;varrequest={origin:start,destination:end,travelMode:google.maps.TravelMode.DRIVING};directionsService.route(request,function(response,status){if(status==google.maps.DirectionsStatus.