草庐IT

protected_property_name

全部标签

javascript - JS 原型(prototype)继承 : childs use the same parent properties?

假设我有Player对象:varplayer=function(name){this.handlers={};}player.prototype.on=function(event,callback){if(!this.handlers[event]){this.handlers[event]=[];}this.handlers[event].push(callback);}效果很好,我可以创建播放器,每个播放器都有自己的一组处理程序。现在假设我需要从player继承:vartestPlayer=function(name){this.name=name;};testPlayer.pr

javascript - react 教程 : Uncaught TypeError: Cannot read property 'data' of null

我正在关注React教程:http://facebook.github.io/react/docs/tutorial.html我只是之后http://facebook.github.io/react/docs/tutorial.html#fetching-from-the-server我在SO上经历了类似的问题,但没有找到适合我的具体案例的解决方案。vardata=[{author:"PeteHunt",text:"Thisisonecomment"},{author:"JordanWalke",text:"Thisis*another*comment"},{author:"BobLi

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

未捕获的类型错误:无法读取未定义的属性“应用”??这是什么意思?我的意思是我尝试调试它,但无法找出问题所在。帮助将不胜感激。你们有什么需要帮助解决这个问题的,请随时问我。谢谢!JSBIN这是我的代码:vargame=newPhaser.Game(500,550,Phaser.CANVAS,'gameDiv');varCountDown={preload:function(){},update:function(){},render:function(){}}varplayer;varbullets;varenemies;vargreenEnemiesvarbulletTimer=0;v

javascript - 类型错误 : mongodb property insertmany is not a function

db.col.insertMany([{"_id":"tt0084726","title":"StarTrekII:TheWrathofKhan","year":1982,"type":"movie"},{"_id":"tt0796366","title":"StarTrek","year":2009,"type":"movie"},{"_id":"tt0084726","title":"StarTrekII:TheWrathofKhan","year":1982,"type":"movie"}]);OS:LinuxMint17.3RosaMongoDB:dbversionv2.6.1

javascript - 未捕获的 InvalidStateError : Failed to read the 'result' property from 'IDBRequest' : The request has not finished

我需要你们的帮助。我正在使用indexedDB。我需要使用Javascript从数据库中的表中读取记录,但我收到一条错误消息,指出来自Chrome浏览器V52UncaughtInvalidStateError:Failedtoreadthe'result'propertyfrom'IDBRequest':请求未完成。下面是我的Javascript代码变量数据库;varavailableJobs=0;window.indexedDB=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexe

javascript - 我如何检查 object.property 是在 Angular 2 中定义的?

Angular2中是否有与Angular1中的angular.isDefined等价的函数勾选安全导航运算符?.,仅在tempalte中支持 最佳答案 Typescript没有检查变量是否定义的函数,Angular2也没有。使用杂耍检查,您可以一次测试null和undefined:if(object.property==null){如果您使用严格检查,它只会对设置为null的值为真,而不会对undefinedvariable求值为真:if(object.property===null){

javascript - Firefox 权限 : 'name' member of PermissionDescriptor 'camera' is not a valid value for enumeration PermissionName

我正在制作一个网络应用,需要使用权限查询来检查是否已授予用户相机访问权限。我试过代码:navigator.permissions.query({name:'camera'}).then(function(result){console.log(result);});它在GoogleChrome70上运行良好,但在firefox上出现错误:TypeError:PermissionDescriptor“camera”的“name”成员不是枚举PermissionName的有效值。我一直在寻找这个问题,但没有任何帮助。有人能帮帮我吗?谢谢, 最佳答案

javascript - 从 RouteProvider 定义 ng-view ="NAME"

我真的是Angular的新手,我有一个关于将模板或URL发送到ng-view的小问题。但是我打算做的方式可能必须在我的基本模板中使用ng-view。当我的模板库是这样的时候:我的JS看起来像:varapp=angular.module('myApp',[]).config(['$routeProvider','$locationProvider','$httpProvider',function($routeProvider,$locationProvider,$httpProvider){$routeProvider.when('/home',{templateUrl:'/conta

javascript - jQuery 用户界面 : Uncaught TypeError: Cannot read property 'display' of undefined

我正在尝试使用jqueryajax获取数据,一切正常,我得到了我想要的,但我无法显示它,因为我收到未捕获的类型错误:无法读取未定义的属性“显示”。这里是代码。有什么想法吗?/**Getthedatafromtheajaxcallanddisplayadialog*/functionCreateDialog(email){//getthedatafromtheajaxcallvarpromise=AjaxSubscribe(email)//ifdataareavailable,showthedialogpromise.success(function(data){//dataisasim

javascript - AngularJS 和 i18n : apply ng-repeat filters after translating list items properties

JSFiddle:http://jsfiddle.net/X2fsw/2/我尝试使用angular-translate创建多语言AngularJS应用程序.我的代码中嵌入了一个静态项目列表。此列表的每个项目都有一个标题,该标题必须以当前选择的语言显示。翻译是在翻译服务的帮助下直接在View中完成的。示例:{{myObject.title|翻译}}。我希望使用ng-repeat显示列表,然后按项目标题过滤它。但是,过滤器应用于翻译键,而不是翻译后的字符串。在保持运行时切换语言的能力的同时更正此行为的最佳方法是什么?我可以在每次语言更改时将翻译后的字符串存储为另一个属性(例如myObjec