草庐IT

using-redis-cache-backend-and-ses

全部标签

javascript - AngularJS fn is not a function error using $timeout with a function with parameters 错误

我正在制作一个您可以编辑文本的网页,在您停止输入1秒后,它会自动保存您输入的内容。目前我正在研究$timeout的细节。当我调用没有参数的update方法时,它可以正常工作,但是当我使用参数调用它时,我得到错误:Error:fnisnotafunction$TimeoutProvider/this.$get为什么我在执行以下操作时会收到此错误:timeout=$timeout(update(element,content),1000);但不是当我这样做的时候:timeout=$timeout(update,1000);显然我需要将参数传递给更新方法,因为我需要知道要更新什么。debou

javascript - 加密错误 : data and hash arguments required

我收到一个bcrypt错误,指出需要数据和哈希参数,引用我的routes.js文件中的第44行。据我所知,我正在传递该信息:bcrypt.compare的第一个参数是用户输入的密码,第二个是从数据库中检索到的散列密码。我做错了什么?bcrypt.compare(req.params.password,user.password,function...routes.js'usestrict'varexpress=require('express');varrouter=express.Router();varUser=require('../app/models/user');//pas

javascript - VideoJS : Stopping video on modal close and not embedding in page

我一直在使用JavaScript脚本VideoJS:http://videojs.com/构建一些可以在弹出窗口中显示给用户的视频播放器。我按如下方式构建了弹出窗口:VideoJS.setupAllWhenReady();jQuery(document).ready(function(){//videoshavevideojsappliedtothem//$("video").VideoJS()$(".show-video").click(function(){$(".video-background").show();$(".video-container").fadeIn("fas

javascript - Chrome 和 IE : parallax (jQuery animate) is not smooth when using mouse wheel to scroll

我改编了this为我的网站使用视差效果的jQuery插件。问题是(即使在上面链接中的演示中)Chrome和IE的滚动真的不流畅。只有当您按下鼠标中键并且滚动是连续的(不是“逐步的”"当您滚动鼠标滚轮时)。所以当你使用鼠标滚轮滚动时,视差效果就完全被破坏了。在Firefox中,即使使用鼠标滚轮滚动,滚动也是连续的。有没有一种方法可以在IE和Chrome中连续滚动(javascript?)。Here是我的网站(如您所见,如果您使用Firefox访问它,效果完全不同)。 最佳答案 我用这个jQuery脚本解决了这个问题(它为键盘和鼠标滚动

javascript - Chrome 扩展 : load and execute external script

我无法将外部js脚本加载到我的chrome扩展中并执行。看起来与thisquestion相同,但我仍然无法弄清楚为什么它在我的情况下不起作用。我的想法是,我想在我的内容脚本中包含一些应该解析网页内容的默认函数。对于一些特定的网页,我想加载和使用特定的解析器,所以我尝试为一个网页加载适当的js脚本,这个脚本应该扩展默认解析器的功能。现在我只尝试从外部脚本执行代码,但有这样的错误:这是我的ma​​nifest.json:{"name":"Extensionname","version":"1.2","description":"Mychromeextension","browser_act

javascript - 如何停止警告 : It looks like you're using the development build of the Firebase JS SDK?

Itlookslikeyou'reusingthedevelopmentbuildoftheFirebaseJSSDK.WhendeployingFirebaseappstoproduction,itisadvisabletoonlyimporttheindividualSDKcomponentsyouintendtouse.FortheCDNbuilds,theseareavailableinthefollowingmanner(replacewiththenameofacomponent-i.e.auth,database,etc):https://www.gstatic.com/

javascript - webpackJsonp 未定义 : webpack-dev-server and CommonsChunkPlugin

这是我的webpack.config.js文件:constwebpack=require('webpack');constpath=require('path');module.exports={cache:true,devtool:'source-map',entry:{app:['./src/index.js'],vendor:['lodash']},output:{filename:'bundle.js',path:path.join(__dirname,'dist'),publicPath:'/dist/',pathinfo:true},module:{loaders:[{te

javascript - 玩!框架 : Best practice to use URLs in separate JavaScript files?

我目前正在重组Play!有很多JS的项目HTML模板文件中的代码。此代码应移至外部JS文件以获得更好的可读性和更快的页面加载时间。然而,当我在公共(public)文件夹中创建一个JS文件时,所有@{Controller.method}链接替换不再有效。我曾是考虑从HTML调用一些初始化函数仅提供所需URL的模板,例如initialize({"Application.doThis":"@{Application.doThis}"})然而,这对于任何URL都变得非常麻烦且容易出错即已添加。另一件事是,I18N也不再有效。所以对于这样的场景,您有自己的最佳实践是什么单独文件中的JS代码,但仍

javascript - "Warning: Task "巴别塔 "not found. Use --force to continue."

我的gruntfile.js中有这个简单的代码:module.exports=function(grunt){require("load-grunt-tasks")(grunt);//npminstall--save-devload-grunt-tasksgrunt.initConfig({babel:{options:{sourceMap:true},dist:{files:{"dist/app.js":["src/app.js"]}}}});grunt.registerTask("default",["babel"]);};但是运行时显示这个错误:Warning:Task"babe

javascript - 谷歌地图 API v3 : computeDistanceBetween method and distance in metric form

我想以公制形式计算位置之间的直接距离。(即:从A到B,以公里为单位)。没看懂computeDistanceBetween方法以单位返回。谢谢 最佳答案 以米为单位。要转换为公里除以10241000,obviously.google.maps.geometry.spherical.computeDistanceBetween(Moscow,Leningrad);//679601m对了,这个库方法的底层代码是基于Haversineformula的. 关于javascript-谷歌地图APIv