草庐IT

is_class

全部标签

javascript - 如何创建一个指令,根据条件在目标元素上添加 ng-class 和 ng-disabled?

我有以下代码:app.directive"ngDisableOnVar",($compile)->restrict:"A"terminal:truepriority:1000replace:falsescope:{}compile:compile=(element,attrs)->cattr=attrs["ngDisableOnVar"]element.attr("ng-class","{'disabled':!#{cattr}}")element.attr("ng-disabled","!#{cattr}")element.removeAttr("ng-disable-on-var"

javascript - 从远程 repo 中拉出并获得 : "Parsing error: The keyword ' import' is reserved"

我收到以下错误:ERRORin./src/main.jserrorParsingerror:Thekeyword'import'isreserved/Users/staging/Desktop/sourcetree/viewer_web/src/main.js:1:1importVuefrom'vue'出于某种原因,我的项目中的ES6功能未被识别?我正在使用Node5.0,这是我的package.json:{"name":"istaging-viewer","description":"AVue.jsproject","author":"Alex","private":true,"sc

javascript - Proxyquire 没有 stub 我需要的类(class)

我有一个类AProvider需要'./b.provider'。constBProvider=require('./b.provider');classAProvider{staticgetdefaultPath(){return`defaults/a/${BProvider.getThing()}`;}}module.exports=AProvider;b.provider.js与a.provider.js相邻,看起来像global.stuff.whatever=require('../models').get('Whatever');//Ididn'twritethis!classB

Javascript 将可变参数传递给父类(super class)构造函数

将可变参数传递给父类(superclass)构造函数的最佳/推荐方法是什么?背景解释了我试图解决的问题。背景我正在将一些代码从Java移植到Javascript。Java的编码模式之一是函数重载。Java选择最佳匹配来确定要调用的函数。当函数是类构造函数时,这会变得很有趣。所以Java中的代码可能是publicclassMyParserextendsParser{publicintparse(Stringstr){super(str);...}publicintparse(Stringstr,intbase){super(str,base);...}}在Javascript中变成:cl

javascript - How to implement a Client-side Ajax Login on Asp.Net MVC (A link to the solution for Asp.Net Webforms is in here)

我正在尝试在Asp.NetMVC上实现客户端ajax登录。我以前在WebForms上设置得很好,但现在我已经转移到MVC上,这给我带来了一些麻烦。如果您想要有关Asp.NetWebforms的客户端Ajax登录的教程,可以找到here--简单,A++现在...出于某种原因,它不适用于Asp.NetMVC。除了执行ssa.login()时,我使用了与Webforms完全相同的教程(等效于:Sys.Services.AuthenticationService.login())它什么也没做。我在onLoginComplete()函数和onError()函数中都有警报。在ssa.login被调

javascript - 原型(prototype) : registry is undefined

我的注册表是未定义的行:5557...原型(prototype)为1.7。$$('#pageNava').each(function(element){element.observe('click',doSome(this.href));})pageNav是带有LI和A标签的UL列表。 最佳答案 这可能不完全适用,但我有一个非常相似的问题。原来我试图附加事件处理程序的对象是未定义的。//objTblisundefined->'registryisundefined'errorEvent.observe(objTbl.rows[i],

javascript - Bootstrap : Responsitive design - execute JS when window is resized from 980px to 979px

我使用的是上一个Twitter的Bootstrap。当我的窗口宽度小于980px时,我想执行某个JS函数(显示一次工具提示)(如你所知,在这个尺寸上,Bootstrap修改Navbar并隐藏标准菜单项)——窗口从768到979,简而言之.这个我知道@media(min-width:768px)and(max-width:979px){...}此选项可用于捕获事件。但是,它可能仅用于更改现有样式,例如body{background-color:#ccc;}我需要启动JS函数,或者为元素添加或删除特定样式。我试过:window.onresize=function(){if(window.o

javascript - 是否可以在 ng-class 中声明注释

我有一个问题,是否可以在ng-class中声明注释ng-class="{'test':true,'test1':true,//somecomment'test2':true}" 最佳答案 好像没有。您可能需要像这样使用多行注释语法:但这会引发错误:SyntaxError:Token'*'isunexpected,expecting[:]atcolumn29oftheexpression[{'test':true,'test1':true,/*somecomment*/'test2':true}]startingat[*somecom

javascript - react 函数说 "is not a function"

我正在努力将一个小React应用程序分解成更小的组件。在分离代码之前,一切都按计划进行。我现在正在尝试调用一个函数onChange,它调用一个函数,然后调用一个函数作为prop。我像这样绑定(bind)函数this.updateInput=this.updateInput.bind(this);但我仍然无法弄清楚我缺少什么。我在这里(React:Passfunctiontochildcomponent)上尝试了最近的一篇文章,但错误仍然存​​在。任何帮助都很棒。这是我正在使用的代码:classWeatherextendsReact.Component{constructor(props

Javascript Prototype Chaining父类(super class)构造函数和方法调用

我是JavaScript世界的新手,在尝试原型(prototype)链继承时遇到了这个奇怪的问题。我有3个类(class)//classparentfunctionparent(param_1){this.param=param_1;this.getObjWithParam=function(val){console.log("valueinparentclass"+val);console.log("Constructorparameter:"+this.param);};};//classchildfunctionchild(param_1){this.constructor(pa