草庐IT

Data-Url

全部标签

javascript - SignalR 调用方法 : connection must be started before data can be sent

这里和GitHub上有很多“必须先启动连接才能发送数据”的问题,但我几乎找不到与集线器相关的问题。$(function(){//Declareaproxytoreferencethehub.varconnection=$.hubConnection('http://www.website.net/');varchat=connection.createHubProxy('MyHub');//Starttheconnection.$.connection.hub.start().done(function(){console.log('Connect!connectionId='+$.c

javascript - Angular-Google-Map : How to Load Map after Position Data Loaded(Lat, Lng)?

我得到了错误:'angular-google-maps:找不到有效的中心属性'。当我$watch从php后端加载我的locationData并执行初始化函数时。HTML:'">AngularController:app.controller('MapCtrl',['$scope',function($scope){'usestrict';$scope.$watch('locationData',function(){varlocation=JSON.parse($scope.locationData);$scope.location={lng:location.longitude,la

javascript - Angular 资源自定义 URL 使用查询字符串和 POST 参数

我在我的应用程序中的Angular资源上编写了一个自定义方法来激活用户。API端点是/users/activate并且必须将激活码放入此端点。这是我的资源的样子:app.factory('User',['$resource',function($resource){return$resource('http://api.site.dev/users/:id',{id:'@id'},{activate:{method:'PUT',params:{code:'@code'},url:'http://api.site.dev/users/activate'}});}]);我在我的Contro

javascript - Ember.js 中查询参数的 URL 编码

我在我的最新项目中使用版本1.7.0-beta.1的Ember.js。我用queryparams使列表在硬刷新后仍然存在的功能(例如,重新加载后,列表中的选定项目仍处于选中状态)。我有一个负责管理的Controller:exportdefaultEmber.ObjectController.extend({queryParams:[{selectedFiles:'files'}],selectedFiles:Ember.A([]),//listoffileids...//otherpropsactions:{selectFile:function(file){//setorremove

Javascript 测试 : Selenium cookies data url

只要需要Javascript,我就有一个运行Selenium的Behat测试。如果使用Javascript(因此Selenium被禁用),我当前的Behat测试工作正常。目前,我从Selenium得到的唯一错误反馈是以下语句:unknown:Failedtosetthe'cookie'propertyon'Document':Cookiesaredisabledinside'data:'URLs.(Sessioninfo:chrome=48.0.2564.109)(Driverinfo:chromedriver=2.20.353124(035346203162d32c80f1dce58

javascript - Angular 2 : sharing data across different routes

我在SO中搜索了类似的问题,但没有找到任何解决我的具体案例的问题。有很多Angular组件之间共享数据的技术,我已经阅读了这篇关于组件通信的文章:https://angular.io/docs/ts/latest/cookbook/component-communication.html但是那里描述的技术都不适合我,因为我的组件在不同的路线上。本文主要描述父子组件通信,有些情况可能适用于兄弟组件,只要它们同时加载即可。我的案例与Angular2Heroes教程非常相似:我有一条路线显示带有客户列表(而不是英雄)的表格。当用户点击特定客户时,我会触发路由更改以显示包含所选客户(而不是英雄

javascript - Angular 单元测试 : Error: Cannot match any routes. URL 段: 'home/advisor'

我正在我的angular4.0.0应用程序下进行单元测试,我的真实组件中的一些方法正在通过以下方式调用手动路由:method(){....this.navigateTo('/home/advisor');....}withnavigateTo是一个自定义路由方法,调用它:publicnavigateTo(url:string){this.oldUrl=this.router.url;this.router.navigate([url],{skipLocationChange:true});}我有这个路由文件:import...//Componentsanddependenciescon

javascript - 我应该使用什么 JavaScript 库来解析 URL 参数?

如何在JavaScript中解析URL参数?(这些参数我通常会称为GET参数或CGI参数,但在这种情况下页面基本上是提交给自己,而不是服务器,所以没有GET请求,也肯定没有CGI程序。)我在网上看到了很多可以复制的例程,但我不知道其中的任何一个有多健壮。我已经习惯了其他语言,例如Perl和Java,在这些语言中,我可以依赖一个经过充分测试且功能强大的库,我知道它可以处理标准中的数百万个小边缘情况。我想在这里做同样的事情,而不仅仅是剪切和粘贴示例。 最佳答案 jQueryURLUtils或jQueryURLParser.

javascript - 在 Iframe 中旋转 URL

我有10个不同的url,我想将它们输入到iframesrc属性中,我还想在iframe中的所有10个url之间每5秒轮换一次。不确定如何使用javascript/最佳方法做到这一点?抱歉,应该提到我正在使用IE6。谢谢。 最佳答案 //startwhenthepageisloadedwindow.onload=function(){varurls=["http://...first","http://...second",//...."http://...tenth"//no,!!];varindex=1;varel=documen

带有空格和 % 的 Javascript window.open url

我正在尝试使用带空格的urlwindow.open:varmsg='Hello,world!';varurl='http://yoursite.com';varlink='http://www.twitter.com/share?text='+msg+'&url='+url;window.open(link);运行此代码将打开一个新窗口,其中包含http://twitter.com/share?text=Hello,%2520world!&url=http://yoursite.com。发生的是msg中的空格被转换为%20,然后'%'被转换为%25。作为解决方法,我添加了:msg=ms