草庐IT

item_types

全部标签

javascript - Sharepoint 2013 通过 REST API : Error 403 Forbidden when trying to create item

我正在尝试使用Sharepoint2013上的其余API创建一个简单的列表项。我的代码:$.ajax({url:siteUrl+"/_api/web/lists/getByTitle('internal_Listname')/items",type:"POST",contentType:"application/json;odata=verbose",data:JSON.stringify({'__metadata':{'type':'SP.Data.internal_ListnameListItem',},'K1F1':k1f1Result,}),headers:{"accept":

javascript - ASP.NET MVC : Masterpage: How to set css class on active menu item

我的母版页中有以下菜单:我需要一种方法来将当前事件的li的css类设置为“当前”。我的第一个猜测是借助javascript来完成此操作。我会在母版页中包含这样的内容:$("#menulia").each(){if($(this).attr("href")==''){$(this).parent("li").addClass("current");}}这是一个好方法吗?如果是,我怎样才能像href中那样获取当前URL部分?如果不是,您有什么建议?:-)仅供引用,我要生成的html:EmployeesCustomer 最佳答案 如果你想

javascript - 流: Dynamically generate string union types?

假设我有一个流类型Suit,我想将它组合成另一种名为Card的类型。//types.jstypeSuit=|"Diamonds"|"Clubs"|"Hearts"|"Spades";typeCard={...suit:Suit,...}与其直接在suit.js中对Suit字符串进行硬编码,不如根据JavaScript原语(数组)动态生成Suit类型?说...//constants.jsconstSUITS=['Diamonds','Clubs','Hearts','Spades'];通过这种方式,西装只需定义一次,并且可以在JavaScript结构中定义,该结构将在应用程序的其他部分中

javascript - 隐式全局 "item"变量 - Internet Explorer 和 FireFox 之间的区别

只是出于好奇..我有这个JS代码:varsomeExternalArray=[{id:1,name:'a'},{id:2,name:'b'},{id:3,name:'c'}];varnewArray=[]//varitem;for(vari=0;i请注意带注释的varitem,它使循环带有隐式声明的item变量。如果我在FireFox上运行这段代码,警告的结果是:0:a,1:b,2:c如果我在InternetExplorer中运行相同的代码,结果是:0:c,1:c,2:c这是jsfiddle:https://jsfiddle.net/fvu9gb26/当然,当我取消对varitem的注

javascript - Angular 2 : Type 'Subscription' is not assignable to type

我创建了一个非常小的应用程序来从json文件中获取国家并将其绑定(bind)到下拉列表。countries.jsonexportclassCountry{id:number;name:string;}factory.service.tsimport{Injectable}from'@angular/core';import{Http,Response}from'@angular/http';import{Observable}from'rxjs/Observable';import{Country}from'./shared/country';@Injectable()exportcl

javascript - "Resource interpreted as script but transferred with MIME type text/html."

很抱歉,如果这实际上是重复的,但我还没有设法找到我的问题的答案。我使用jQuery的$.getScript加载脚本。但它会导致以下错误:ResourceinterpretedasscriptbuttransferredwithMIMEtypetext/html.该问题仅在MacOS下的Safari中出现如果查看从服务器收到的header,它们包含Content-Type:application/x-javascript,所以我真的不明白问题出在哪里。 最佳答案 Resourceinterpretedasscriptbuttransf

javascript - typescript TS7015 : Element implicitly has an 'any' type because index expression is not of type 'number'

我在Angular2应用程序中遇到此编译错误:TS7015:Elementimplicitlyhasan'any'typebecauseindexexpressionisnotoftype'number'.导致它的代码是:getApplicationCount(state:string){returnthis.applicationsByState[state]?this.applicationsByState[state].length:0;}但这不会导致此错误:getApplicationCount(state:string){returnthis.applicationsBySt

javascript - 尝试使用 gh-pages 部署我的 React 应用程序但收到此错误消息 : The "file" argument must be of type string. Received type undefined

我试图用gh-pages部署我的React应用程序,但我遇到了这个错误:"file"参数必须是字符串类型。接收类型未定义。起初,我以为这是我的代码,所以我制作了另一个没有修改的create-react-app,尝试使用npmrundeploy命令进行部署,但再次收到此错误消息。我的package.json(我添加了我的homepage链接、predeploy和deploy脚本,以及gh-页面依赖):"name":"test-deploy","version":"0.1.0","private":true,"homepage":"https://vnsteven.github.io/te

javascript - 错误 TS7017 : Index signature of object type implicitly has an 'any' type in form validation angular 2

我在给出的Angular2中进行响应式(Reactive)验证时遇到编译错误errorTS7017:Indexsignatureofobjecttypeimplicitlyhasan'any'type为了this.comErrors[field]='';constmessages=this.validationMessages[field];this.comErrors[field]+=messages[key]+'';它正在按应有的方式运行,但是当我尝试运行npmrunbuild.prod时,出现错误并且无法构建我的项目这是我的代码:onValueChanged(data?:any)

javascript - 错误 TS2315 : Type 'ElementRef' is not generic material angular

在项目中添加AngularMaterial时出错ERRORinnode_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(136,20):errorTS2315:Type'ElementRef'isnotgeneric.node_modules/@angular/material/button-toggle/typings/button-toggle.d.ts(154,104):errorTS2315:Type'ElementRef'isnotgeneric我正在尝试安装MaterialDesign,但