草庐IT

MATCH_PARENT

全部标签

javascript - Angular 翻译 : Child Module translatePartialLoader urlTemplate overrides the Parent Module translatePartialLoader urlTemplate

我必须使用多个具有不同urlTemnplate的translatePartialLoader。我正在使用angular-translate-loader-pluggable。看起来子模块urltemplate覆盖了父模块urltemplate父模块配置$translateProvider.useLoader('$translatePartialLoader',{urlTemplate:__env.hostUrl+'/*****/****/localization/resource_bundle?bundle_name={part}&locale={lang}'});$translate

javascript - ES6 继承 : uses `super` to access the properties of the parent class

Javascript的super关键字,当我在Chrome、Babel、TypeScript上运行代码时,我得到了不同的结果。我的问题是哪个结果是正确的?规范的哪一部分定义了这种行为?以下代码:classPoint{getX(){console.log(this.x);//C}}classColorPointextendsPoint{constructor(){super();this.x=2;super.x=3;console.log(this.x)//Aconsole.log(super.x)//B}m(){this.getX()}}constcp=newColorPoint();

Javascript 正则表达式 : Match anything but newlines (\r?\n)

我想让我的RegExp匹配除换行符以外的任何内容\r?\n 最佳答案 应该这样做:/(?:[^\r\n]|\r(?!\n))/g这匹配除\r和\n之外的任何字符,或者匹配后面没有\n的单个\r。 关于Javascript正则表达式:Matchanythingbutnewlines(\r?\n),我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4344819/

javascript - NodeJS - 如何让生成的 child 与 parent 沟通?

我正在尝试这个:varchild=spawn('node',args,{cwd:parentDir,stdio:'ipc'});(args是一个参数数组)但它给出了以下错误:TypeError:Incorrectvalueofstdiooption:ipc这确实有效,所以问题似乎确实出在stdioipc参数上:varchild=spawn('node',args,{cwd:parentDir});这也有效:varchild=spawn('node',args,{cwd:parentDir,stdio:'pipe'});我读到这个:http://nodejs.org/api/child_

javascript - 我无法准确理解 JavaScript 的方法 string.match(regexp) 的 g 标志是如何工作的

在《JavaScript:TheGoodParts》一书中解释了方法string.match(regexp)如下:Thematchmethodmatchesastringandaregularexpression.Howitdoesthisdependsonthegflag.Ifthereisnogflag,thentheresultofcallingstring.match(regexp)isthesameascallingregexp.exec(string).However,iftheregexphasthegflag,thenitproducesanarrayofallthem

javascript - Angular 2 : Validate child component form fields from the parent component

问题陈述:父组件有标签和一些里面的标签,子组件也有一些标签,父组件有一个我们正在验证提交表单时的表单字段。如何验证子组件来自父组件的字段submit表格?要求:如果父组件的表单包含带有input的子组件模板中的组件,然后是这些input如果从父组件提交,组件应该在点击时验证。调查结果:SO中有很多帖子有相同的问题陈述,但没有找到任何合适的解决方案。以下所有帖子都验证了整个表单,但我的要求是验证子组件中的每个字段。Angular2validationtogetherwiththechildcomponentAllowtemplate-drivenforminputsacrossacomp

javascript - preg_match 的 JavaScript 等价物是什么?

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Howcaniusepreg_matchinjQuery?PHPpreg_match功能的jquery等效项是什么?在PHP中它将是:preg_match('/[^a-zA-Z0-9]/',$str);检查字符串是否包含字母和数字以外的任何内容。我想在我的网站上添加一些客户端验证,但我看了又看,找不到与此等效的jQuery。谢谢。

javascript - D3 : use nest function to turn flat data with parent key into a hierarchy

我确信有一种非常简单优雅的方法可以做到这一点,但我不太明白。我有一些看起来像这样的输入数据:[{id:1,name:"Peter"},{id:2,name:"Paul",manager:1},{id:3,name:"Mary",manager:1},{id:4,name:"John",manager:2},{id:5,name:"Jane",manager:2}]如果可能,我想使用d3.js嵌套运算符来获取要在层次结构布局中使用的结构。像这样:[{name:"Peter",children:[{name:"Paul",children:[{name:"John"},{name:"Jan

Javascript 继承 : Parent's array variable retains value

我在这里尝试在JavaScript中使用继承,我发现Parent类中的数组值被Child类继承时出现问题。下面的代码是正常的继承:varParent=function(){this.list=[];};varChild=function(){};Child.prototype=newParent;Child.prototype.constructor=Child;varobj1=newChild;obj1.list.push("hello");console.log(obj1.list);//prints["hello"];当我将新的Child对象(继承包含名为list的数组变量的Pa

javascript - jquery如何获取 parent 的姓名

我正在搜索提供父级名称的元素。这:$('.Item').click(function(){vara=$(this).parent();alert(a[0].tagName);});只是说“DIV”,但我需要一个元素的真实名称。谢谢 最佳答案 尝试以下(提醒标签名称,然后是真实姓名):我使用了$(a[0]).attr('name');例如$('.Item').click(function(){vara=$(this).parent();alert(a[0].nodeName.toLowerCase());//TagNamealert(