草庐IT

vendor_module_check

全部标签

javascript - karma 提示 'Module is not available'

直到几天前,我的单元测试运行良好,我的代码在浏览器中运行完美。然后我在添加一个名为“profile”的stub模块后注意到了这一点:INFO[karma]:Karmav0.12.24serverstartedathttp://localhost:9876/INFO[launcher]:StartingbrowserPhantomJSINFO[PhantomJS1.9.7(MacOSX)]:Connectedonsocket7W-0vnkWZaWxYYtwFrhTwithid9336780PhantomJS1.9.7(MacOSX)ERRORError:[$injector:nomod]

javascript - ng-model 防止选中 ="checked"默认选择单选按钮

当我使用checked="checked"时,ng-model会阻止单选按钮被默认选中。有谁知道是什么原因造成的? 最佳答案 您应该使用Angular附带的ngChecked指令。文档:http://docs.angularjs.org/api/ng.directive:ngChecked 关于javascript-ng-model防止选中="checked"默认选择单选按钮,我们在StackOverflow上找到一个类似的问题: https://stacko

Javascript 性能 : How to check what is slowing down the page?

我有一个非常慢的页面,不是在加载方面,而是在页面上的表单字段中键入时的响应速度方面。页面上没有ajax——这与网络传输无关。发现代码瓶颈的好策略是什么?我在chrome开发人员工具中找不到任何东西可以告诉我瓶颈在哪里。 最佳答案 Webkit有一个“配置文件”选项。打开开发人员工具(ctrl+shift+i)并单击“配置文件”。从那里您可以在底部看到一个录制按钮(圆圈)。单击它并像往常一样使用您的页面。再次单击它以停止并检查函数调用的时间线!或者,您可以使用以下方法单独对函数进行基准测试:console.time("Somelabe

javascript - 是否有为 "javascript revealing module pattern"创建大纲 View 的 eclipse 插件?

我喜欢eclipse,经过一些调整它可以用于javascript编程。有语法完成、linting、格式化,还有“大纲”,尽管只适用于简单的javascript文件。让我恼火的是,遵循“显示模块”设计模式的文件没有“大纲View”。这恰好是我最喜欢的编码风格。是否有某个地方的插件向Eclipse添加了一个“扩展的”大纲View,该View能够“看到内部”以“显示模块样式”编写的.js文件的嵌套结构,显示封装的私有(private)函数和成员?(对于这种类型的样式,正常的“eclipse大纲View通常是空的”)。 最佳答案 再次回答我

JavaScript 模块模式 : How do private methods access module's scope?

在实现模块模式时,私有(private)函数如何访问模块的私有(private)属性?我还没有看到开发人员这样做的任何例子。有什么理由不这样做吗?varmodule=(function(){//privatepropertyvarnumber=0;//privatemethod_privateIncrement=function(){//howdoIaccessprivatepropertieshere?number++;};//publicapireturn{//OKgetNumber:function(){returnnumber;},//OKincrNumber:function

javascript - jQuery/JavaScript : Click event on a checkbox and the 'checked' attribute

代码:$('input.media-checkbox').live('click',function(e){e.preventDefault();varthat=$(this);if(that.attr('checked')=='checked'){varm=that.attr('media');varmid='verify_'+m;that.parents('div.state-container').find('ul.'+mid).remove();that.attr('checked',false);}else{varurl=AJAX_URL;$.ajax({type:'GET'

javascript - react : Can I check if a state exists before rendering it

我是React的新手,我制作了一个显示用户名user的导航栏{this.state.name}但问题是如果用户未登录,我会收到一个错误,因为this.state.name未定义。有什么方法可以在将它呈现为导航栏的一部分之前检查是否已定义this.state.name还是有更好的方法来消除此错误? 最佳答案 当然,使用三元:render(){return(this.state.name?{this.state.name}:null);}甚至更短render(){return(this.state.name&&{this.state.n

javascript - Breeze 错误 : Illegal construction - use 'or' to combine checks

我遇到了这个Breeze错误[Illegalconstruction-use'or'tocombinechecks]在加载实体的编辑页面时在Chrome上。当我刷新页面时,错误消息不再出现。这个错误在我的网站上随机发生,不定期发生。我无法使用特定场景重现它,只是随机遇到它。我在Breeze代码中看到这条错误消息if(curContext.prevContext===null){curContext.prevContext=context;//justupdatetheprevContextbutdon'tchangethecurContext.returnthat;}elseif(co

javascript - 错误 : Unexpected value 'FormGroup' declared by the module 'DynamicTestModule'

我们的项目结构如下:Angular2-webpack-starter.我们的项目成功编译、构建并可以在浏览器中看到。这里没有问题。但是当我们尝试使用karma和jasmine运行测试用例时,我们遇到了这个错误。XXXXComponent:heavy_multiplication_x:ShouldMatchCurrentTabas1Chrome55.0.2883(MacOSX10.10.5)Error:Unexpectedvalue'FormGroup'declaredbythemodule'DynamicTestModule'atSyntaxError.ZoneAwareError(w

javascript - AngularJS - 将提供程序注入(inject) module.config

我做错了什么?根据文档,我应该能够注入(inject)provider至module.config...但我遇到错误-“UnknownProvider”http://jsfiddle.net/g26n3/(function(){"usestrict";angular.module("ab.core",[]).provider("ab.core.provider",function(){console.log("ab.core.provider-constructor");this.$get=function(){console.log("ab.core.provider-get");r