草庐IT

angular2-in-memory-web-api

全部标签

Javascript 谷歌音译 API 不通过 h​​ttps 提供

JavaScriptgoogletransliterateAPI不通过h​​ttps提供服务。我得到以下混合内容错误。它在http网站上工作,但不适用于https。我已尝试通过以下所有方式调用API。错误:MixedContent:Thepageat'https://extranuclear-freque.000webhostapp.com/lang.html'wasloadedoverHTTPS,butrequestedaninsecurescript'http://www.google.com/inputtools/request?text=gy&ime=transliterati

javascript - 如何逐行读取angular2上的csv文件

我正在用angular2编写一个应用程序,它读取一个csv文件,只需在html中输入:我可以访问component.ts中的文件:ngOnInit(){varinput=(document.getElementById("file"));input.addEventListener("change",function(event){varfiles=input.files;varlen=files.length;if(len){console.log("Filename:"+files[0].name);console.log("Type:"+files[0].type);consol

javascript - "export ' createNetworkInterface ' was not found in ' Apollo 客户端'

我做了这个样本:https://github.com/Akryum/vueconf-2017-demo因此,我的项目中有相同的文件:https://github.com/Akryum/vueconf-2017-demo/blob/master/src/apollo-client.js这是我的应用程序中使用的代码:import{ApolloClient,createNetworkInterface}from'apollo-client'constapolloClient=newApolloClient({networkInterface:createNetworkInterface({u

javascript - 如何在 Angular 5 中使用 HttpClient 访问响应 header ?

我在Angular5中编写了一个身份验证服务,它使用HttpClient类向我的后端发出POST请求。后端通过发送JWT不记名token进行响应。我的请求是这样的:returnthis.http.post('http://127.0.0.1:8080/api/v1/login',{'username':username,'password':password},{headers:newHttpHeaders().set('Content-Type','application/json')}).toPromise().then(response=>{console.log(respons

javascript - ReactJS API 数据获取 CORS 错误

几天来,为了实习,我一直在尝试创建一个ReactWeb应用程序,但我遇到了CORS错误。我正在使用最新版本的reactJS,并将其放在create-react-app中,下面是获取代码:componentDidMount(){fetch('--------------------------------------------',{method:"GET",headers:{"access-control-allow-origin":"*","Content-type":"application/json;charset=UTF-8"}}).then(results=>results.

javascript - "Found @client directives in query but no client resolvers were specified"使用客户端缓存时出现警告

我一直在关注ApolloClientdocs在地方州。我实现了一个非常简单的客户端缓存查询:exportconstGET_USER_ACCOUNTS=gql`queryGetUserAccounts{userAccounts@clientname@client}`;userAccounts和name在验证后都存储在我的缓存中:{localStorage.setItem('token',token);client.writeData({data:{isLoggedIn:true,userAccounts,name:`${givenName}${familyName}`,},});}}>并

javascript - Angular $httpBackend.expectGET - 响应 409 状态和自定义 statusText

尝试在单元测试中创建$httpBackend.expectGET以返回409状态和“TestPhrase”的自定义statusText。查看Angular文档(https://docs.angularjs.org/api/ngMock/service/$httpBackend)它给出了以下返回内容的示例:{function([status,]data[,headers,statusText])|function(function(method,url,data,headers)}无法理解如何解释上述示例。我当前的代码是:$httpBackend.expectGET('/example/

javascript - 使用 Google Map API V3 时不显示 GeoJSON 点名称和描述

我开始使用GoogleMapJavascriptAPIV3,并希望使用GeoJSON在map上显示标记。我的GeoJSON如下:{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[153.236112,-27.779627]},"properties":{"name":"[153.236112,-27.779627]","description":"Timestamp:16:37:16.293"}},{"type":"Feature","g

javascript - 如何使用 Javascript 数学库计算直 Angular 三 Angular 形的 Angular ?

考虑以下三Angular形:我想计算AngularX我有以下内容:varopposite=2.5;varhypotenuse=5;varsinOfAngleX=opposite/hypotenuse;//0.5现在我知道Math.sin(valueofAngleX)会返回0.5。但是,如果我知道Angular正弦值,如何使用Math()库获取Angular值?根据thistutorial,我需要做的:varangleX=sin的0.5的负数次方但我不知道如何将其翻译成JS。我试过了:varangleX=Math.pow(Math.sin(sinOfAngleX),-1);但它返回2.0

javascript - 使用 JavaScript Youtube API 上传文件 - 未定义 MediaUploader

我正在开发一个网络应用程序,试图在Youtube上共享视频,本质上是添加一个“上传到youtube”按钮。我正在尝试使用适用于JavaScript的Youtube数据API,遵循此示例https://developers.google.com/youtube/v3/code_samples/javascript#upload_video.我的代码与示例中的相同。一切顺利,直到我从这行代码中收到错误“MediaUploaderisnotdefined”:varuploader=newMediaUploader({示例代码中似乎没有定义MediaUploader类。我通过GoogleAPI