草庐IT

find_first_of

全部标签

javascript - mongoose .find() 方法返回具有不需要属性的对象

因此,我使用mongoose已经有一段时间了,我发现了一些非常奇怪的事情。如果有人能启发我,那就太好了。问题是,当使用Mongoose的.find()方法时,我作为响应获得的对象充满了我不知道它来自哪里的属性(我猜它们是内置属性,但是随便),我只想遍历我.select()的属性。知道了?不?好的...更好地解释:我声明了我的架构和模型:varmySchema=mongoose.Schema({name:String,prop1:String,prop2:String,prop3:String})varmyModel=DB.model('myDataBase',mySchema)然后我想

javascript - 未捕获的类型错误 : cannot read property 'innerHTML' of null

谁能解释一下这个错误是什么?UncaughtTypeError:cannotreadproperty'innerHTML'ofnull这是导致问题的行:varidPost=document.getElementById("status").innerHTML; 最佳答案 varidPost=document.getElementById("status").innerHTML;您的网页中不存在“状态”元素。因此document.getElementById("status")返回null。虽然您不能使用NULL的innerHTML属

javascript - 错误 : Cannot find module 'jade~'

我是Nodejs的新手。我使用CompoundJs创建了一个crud操作。应用程序运行良好,直到我尝试提醒一个值,之后我收到错误500Error:Cannotfindmodule'jade~'atFunction.Module._resolveFilename(module.js:338:15)atFunction.Module._load(module.js:280:25)atModule.require(module.js:362:17)atrequire(module.js:378:17)如何解决这个问题我的索引#tabsullia(href='#tabs-1')NewLeave

javascript - ruby rails : "couldn' t find file 'jquery.ui.datepicker' "

好吧,这让我抓狂。我一直按照说明在此处安装JQuery日期选择器:http://railscasts.com/episodes/213-calendars-revised但我被这个错误挂断了:Sprockets::FileNotFoundinVerifications#newcouldn'tfindfile'jquery.ui.datepicker'(in/app/assets/stylesheets/application.css:11)这是application.js://=requirejquery//=requirejquery.ui.all//=requirejquery_u

javascript - 谷歌地图脚本打破 Safari TypeError : Result of expression 'document.body' [null] is not an object

我在我的网页中显示谷歌地图,它在除Safari之外的所有浏览器中都能正常工作。Safri使页面变白并且JS错误显示:TypeError:Resultofexpression'document.body'[null]isnotanobject.maps.google.com/maps/api/js?sensor=true®ion=nz&async=2&callback=initializeConfigMap:11TypeError:Resultofexpression'a'[null]isnotanobject.maps.gstatic.com/intl/en_us/mapfile

javascript - Steam 发布请求 - 无法加载资源 : the server responded with a status of 400 (Bad Request)

我正在尝试发送这样的帖子请求:xhr.open("POST","/steamapi/actions/RemoveFriendAjax",false);varparams="sessionID="+session_id+"&steamid="+id;xhr.onreadystatechange=function(){//Callafunctionwhenthestatechanges.if(xhr.readyState==4&&xhr.status==200){alert(xhr.responseText);}}xhr.send(params);我正在使用Apache服务器,这是我的.h

javascript - 未捕获的类型错误 : Cannot read property 'focus' of undefined

此问题在我的页面加载时发生。使用以下脚本-jquery.simplemodal-1.4.3.js-jqueryv1.7.1下面是一个小代码快照,是发生此错误的simplemodal内的代码。focus:function(pos){vars=this,p=pos&&$.inArray(pos,['first','last'])!==-1?pos:'first';//focusondialogorthefirstvisible/enabledinputelementvarinput=$(':input:enabled:visible:'+p,s.d.wrap);setTimeout(fun

javascript - 控制台集成 : get number of errors/warnings thrown?

所以如果你打开检查器,你会得到这个(如果你不走运的话):我正在构建一个显示调试信息的微型JS组件-有什么方法可以读取到目前为止遇到的错误和警告的数量吗?我想出的一个hacky解决方案涉及一些技巧,用我自己的函数替换console.(error|log|warn)函数,但我还没有测试它是否有效对于所有情况(例如,在我拥有的代码之外)。有更好的方法吗? 最佳答案 如this回答中所述,更改native对象/方法的行为通常不是一个好主意。但是,以下代码应该以一种相当无害的方式为您提供所需的内容://AddthisIIFEtoyourcod

javascript - 拖动 : Replacement of the data

我得到了一个包含一些html元素的网页,其中包括一个文本区域和一个嵌入式contenteditableiframe(一个rte)。使用这段代码,我设法在主页上捕获拖动手势事件并设置文本/html数据jQuery(document).bind('draggesture',function(event){event.originalEvent.dataTransfer.setData('text/html','my_data');});现在,当拖放到主页上的文本区域时,“my_data”会被丢弃。放入contenteditableiframe也会掉落“my_data”。但是我在这里遇到了三

javascript - 在 karma 中使用 angular.mock.inject 给出 "TypeError: Cannot read property ' $injector' of null"

我正在尝试使用Karma对AngularJS进行一些基本的单元测试。我编写的所有测试在语法上似乎都是正确的。但是我在最基本的步骤中遇到了问题,即代码的beforeEach部分。当我尝试运行测试时,出现以下问题TypeError:Cannotreadproperty'$injector'ofnullatObject.workFn(http://localhost:9876/absolute/Users/vesriram/Documents/AngularJS%20project/vendor/js/angular-mocks.js:1698:15)atObject.(http://loc