草庐IT

protected_property_name

全部标签

javascript - Mocha 测试 : Uncaught TypeError: Cannot read property 'status' of null

学习TDD和我对“HelloWorld”服务器响应的第一个简单测试在Mocha中失败了。我正在使用Mocha.js、Superagent和Expect.js。当我curl-ilocalhost:8080时,我得到了正确的响应和状态代码。HTTP/1.1200OKContent-Type:text/plainDate:Mon,27Apr201517:55:36GMTConnection:keep-aliveTransfer-Encoding:chunkedHelloWorld测试代码:varrequest=require('superagent');varexpect=require('

javascript - 无法分配给对象 'name' 的只读属性 '[object Object]'

以下代码只会为name属性抛出错误。它可以通过在Object.create参数中将name属性指定为可写来修复,但是我试图理解为什么会这样(也许有一种更优雅的方法来修复它)。varBaseClass=function(data){Object.assign(this,data);}varExtendedClass=function(){BaseClass.apply(this,arguments);}ExtendedClass.prototype=Object.create(BaseClass);console.log(newExtendedClass({type:'foo'}));n

javascript - AngularJS 拦截器类型错误 : Cannot read property 'headers' of undefined

我在尝试实现AJAXSpinner加载代码时由于未知原因收到此错误。我不明白应该在哪里定义header。我做了console.log(config)但我可以看到headers:accept:text/html值。下面是我的代码:/***SpinnerService*///SpinnerConstantsdiary.constant('START_REQUEST','START_REQUEST');diary.constant('END_REQUEST','END_REQUEST');//Registertheinterceptorservicediary.factory('ajaxIn

javascript - 类型错误 : Cannot read property 'push' of undefined, JavaScript

我在这个Angular项目中工作,用户在该项目中提交评论表单,新评论会添加到已发布的评论中。这是我的代码。.controller('productCtrl',function($scope,$http,$routeParams,Page){$scope.product={};$scope.review={};$scope.comments={};routeparm=$routeParams.param;$scope.review=function(){varreview_box=$scope.review_form.review_box;$http.post('./comment.ph

javascript - 使用 map 时 react 'cannot read property of undefined'

我正在从teamtreehouse.com制作一个非常基本的React应用程序,并且我经常遇到"TypeError:Cannotreadproperty'onPlayerScoreChange'ofundefined"即使我正确地绑定(bind)了我的函数(我认为)'onPlayerScoreChange'是Grandparent组件中的一个方法,当用户点击“+”或“-”按钮更改玩家得分时执行。如果有人能解释出什么问题,那将非常有帮助,因为我想我在曾祖parent的构造函数中设置了this.onPlayerScoreChange=this.onPlayerScoreChange.bin

javascript - jQuery:IE8 中的 "Unexpected call to method or property access"

关闭。这个问题不符合StackOverflowguidelines.它目前不接受答案。关闭8年前。这个问题是由于打字错误或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。这个问题似乎是题外话,因为它缺乏足够的信息来诊断问题。更详细地描述您的问题或includeaminimalexample在问题本身。Improvethisquestion每当我在我的代码中按下某个按钮时,我都会收到该错误,删除以下行会使错误消失并且该按钮起作用:$(selector_value_object).html(value_object);我

javascript - Angularjs/ ionic 类型错误 : Cannot read property 'then' of undefined

代码:js:angular.module('starter.services',['ngResource']).factory('GetMainMenu',['$http','$q','$cacheFactory',function($http,$q,$cacheFactory){varmethodStr='JSONP';varurlStr='http://localhost/bd/wp-admin/admin-ajax.php';varptStr={action:'bd_get_main_menus',callback:'JSON_CALLBACK'};return{getMainM

javascript - 在 Chrome 中工作,但在 Safari 中中断 : Invalid regular expression: invalid group specifier name/(? <=\/)([^#]+)(?=#*)/

在我的Javascript代码中,这个正则表达式/(?在Chrome中工作正常,但在safari中,我得到:Invalidregularexpression:invalidgroupspecifiername有什么想法吗? 最佳答案 看起来像Safaridoesn'tsupportlookbehindyet(即您的(?)。一种替代方法是将/在非捕获组之前出现的,然后仅提取第一组(/之后和#之前的内容)。/(?:\/)([^#]+)(?=#*)/此外,(?=#*)很奇怪-你可能想要向前看某些东西(例如#或字符串的末尾),而不是*量词(

javascript - 编译转换 : The type or namespace name could not be found when running TypeLite. tt

免责声明:我对这里使用的几乎每一项技术都是新手,所以如果我遗漏了明显的内容,请原谅我......我开始将MVC4与EntityFramework5和WebAPI混为一谈,我想使用TypeScript和Knockout来做一些UI的事情。我找到了TypeLite项目,它将采用我的EF模型并为我生成TypeScript接口(interface),以便所有内容都是“强”类型的。我的解决方案包含3个项目:MyApp.dll=包含所有MVC工作MyApp.Domain.dll=包含EF域模型MyApp.WebAPI.dll=包含WebAPI工作我将TypeLite引用添加到MyApp项目(通过N

javascript - "Can' t 绑定(bind)到 'ngModel' 因为它是 't a known property of ' p-calendar '"尝试使用 PrimeNG 组件的错误消息,为什么?

我是Angular2\4的新手,我正在尝试按照这个快速视频教程将PrimeNG组件添加到我的Angular项目中:https://www.youtube.com/watch?v=6Nvze0dhzkE和PrimeNG教程页面的入门部分:https://www.primefaces.org/primeng/#/setup所以这是我的app.component.htmlView:Welcometo{{title}}!!{{value|date:'dd.mm.yyy'}}如您所见,我插入了这个标签来显示日历组件:(如该组件的官方文档所示:https://www.primefaces.org/