草庐IT

field_property_sample

全部标签

javascript - Angular 6 : Can't bind to 'formGroup' since it isn't a known property of 'form' ?

我曾在Angular2/4中使用表单构建器,但现在我在Angular6中使用它。我已经看到这个问题(Can'tbindto'formGroup'sinceitisn'taknownpropertyof'form')但它是针对Angular2的。我对angular4做了完全相同的事情,但我收到了这个错误。请帮忙:我的代码是:app.module.ts:(我已经导出了FormsModule和ReactiveFormsModule):import{BrowserModule}from'@angular/platform-browser';import{NgModule}from'@angul

Javascript/jQuery : How to prevent active input field from being changed?

如何防止用户在不使用disabled="true"的情况下更改输入字段中的值(其中包含要复制到剪贴板的特定值)?一旦用户在该字段中单击(已经可以正常工作),就应该选择文本,但输入任何内容都不会产生任何效果。谢谢jQuery('input.autoselect[value]').focus(function(){jQuery(this).select();}); 最佳答案 输入html中的readonly是防止用户编辑输入所需的全部内容。 关于Javascript/jQuery:Howto

javascript - d3-drag 0.3.0 - "Cannot read property ' button' of null"

我正在尝试将d3-drag与Canvas一起使用:select(canvas).call(drag().container(canvas).subject(partial(getNodeAtMouse,simulation,canvas)).on('start',someFunction))但是,当我实际尝试拖动时出现以下错误:Cannotreadproperty'button'ofnull从d3-drag(d3原始源代码)中的以下行functiondefaultFilter(){return!d3Selection.event.button;}如果我删除该函数(通过指定我自己的过滤器

javascript - Chrome 性能 : "standard" property names vs. 非标准

所以这是一个有趣的问题......当我测试setAttribute与元素上的普通属性集的性能时,我发现了一个奇怪的行为,然后我在常规对象上测试了它......它仍然很奇怪!因此,如果您有一个对象A={},并将其属性设置为A['abc_def']=1或A.abc_def=1,它们基​​本相同。但是,如果你执行A['abc-def']=1或A['123-def']=1那么你就有麻烦了。它走得更慢。我在这里设置了一个测试:http://jsfiddle.net/naPYL/1/.它们在除chrome之外的所有浏览器上都工作相同。有趣的是,对于“abc_def”属性,正如我所料,chrome实

javascript - "Cannot read property ' xxx ' of null"

我有一个包含子项的文档片段,我想循环(如果可能)。这会导致错误“无法读取null的属性‘xxx’”。我如何测试是否会出现这种情况? 最佳答案 您可能需要执行以下操作:if((documentFragment!==null)&&documentFragment.hasOwnProperty('xxx')){//handlepropertyxxxofdocumentFragmentasrequired} 关于javascript-"Cannotreadproperty'xxx'ofnull"

javascript - 松弛传入 webhook : Request header field Content-type is not allowed by Access-Control-Allow-Headers in preflight response

我尝试在浏览器中通过fetchAPI发布slack消息:fetch('https://hooks.slack.com/services/xxx/xxx/xx',{method:'post',headers:{'Accept':'application/json,text/plain,*/*','Content-type':'application/json'},body:JSON.stringify({text:'Hithere'})}).then(response=>console.log).catch(error=>console.error);};我收到以下错误消息:FetchA

javascript - 未捕获的类型错误 : Cannot read property 'appendChild' of null

这个问题在这里已经有了答案:WhydoesjQueryoraDOMmethodsuchasgetElementByIdnotfindtheelement?(6个答案)关闭7个月前。我收到以下错误UncaughtTypeError:Cannotreadproperty'appendChild'ofnullmyRequest.onreadystatechange@script.js:20用我下面的代码//index.htmlSimplePageThisisanAJAXExample这是我的JavaScript文件//script.js//1.CreatetherequestvarmyReq

javascript - 这个错误 "Declaration of instance field not allowed after declaration of instance method."是什么意思

在我的Angular2项目中,我收到此错误:“在声明实例方法之后不允许声明实例字段。相反,这应该出现在类/接口(interface)的开头。(成员排序)”我想了解如何解决这个问题以及我为什么会遇到这个问题。错误与下一段代码中的私有(private)函数有关:exportclassHomeComponentimplementsOnInit{publicerror:string;publicshirts=[];constructor(publicrest:RestService,publicscService:ShoppingCartService,publicsnackBar:MdSna

javascript - 为什么我有这个错误 : Object doesn't support property or method 'forEach' for Internet Explorer?

我正在使用maven在jenkins插件上使用Javascript,我有以下代码:functionarrayElements(element,index,array){vararrayPaths=element.split("\\");varprojectSource=arrayPaths[2];vararray=element.split("_");if(projectSource===global){if(array[2]===filtro){document.getElementById("source").options.add(newOption(arrayPaths[3],

javascript - jQuery 验证与 Summernote 编辑器错误 : Cannot read property 'replace' of undefined

我正在使用MVC5通过summernote编辑器构建一个表单。Razor代码:@Html.LabelFor(model=>model.Content,htmlAttributes:new{@class="control-label"})@Html.EditorFor(model=>model.Content,new{htmlAttributes=new{@class="form-controlpost-content"}})@Html.ValidationMessageFor(model=>model.Content,"",new{@class="text-danger"})JS:$(