Tag: jquery

是否有可能在angularjs中从控制器调用一个特定的函数?

我是MEAN堆栈开发的初学者,做了一个Todo应用程序,其中我创build任务表,然后使用angularjs存储在特定任务表的待办事项中。 最初,我只是在不考虑它属于哪个任务表的情况下检索所有的待办事项,并且正在创build待办事项。 现在我想增强它来检索只有特定的任务表的todos。 由于我dynamic地想要加载它,我正在使用具有值'/:TaskID' ,其中TaskID正在改变的routeProvider。 所以如果TaskID存在,我正在使用一个函数,否则检索一切。 像这样的东西: if($routeParams.TaskID) { var id = $routeParams.TaskID; Todos.getTodosForId(id) .success(function(data) { $scope.loading = false; $scope.formData = {}; // clear the form so our user is ready to enter another $scope.todos = data; // assign our new list of todos }); } else { // GET===================================================================== // when landing on the […]

Node.js AJAXfile upload

我正在尝试使用AJAX进度条制作Node.jsfile upload器。 var formidable = require('./formidable'), http = require('http'), sys = require('sys'); http.createServer(function(req, res) { if (req.url == '/upload' && req.method.toLowerCase() == 'post') { // parse a file upload var form = new formidable.IncomingForm(); form.uploadDir = './node_uploads'; form.keepExtensions = true; //print the upload status in bytes form.addListener("progress", function(bytesReceived, bytesExpected) { //progress as percentage progress = […]

将jquery数据发布到Express

无论req.params / req.query / req.body和$ .post({..}我使用什么组合,我都无法从我的Jquery post请求中快速提取JSON数据。 这是我的jQuery : $.post("/mail", {email : "s@gmail.com", name : "s@gmail.com"}); 我也尝试了各种排列: $.ajax({type: "POST", url: "/mail", dataType :"json", data : {email : "s@gmail.com", name : "s@gmail.com"}}); 这是我的node.js 表示代码: app.post("/mail", function(req, res) { console.log(req.body.name); console.log(req.route); console.log("params1: " + req.param.params); …. 我尝试了无数的方式来访问数据电子邮件和名字没有成功。 如果解决scheme是req.body / req.params的简单修改,但是任何事情都是可能的,我会感到惊讶! 数据只是不存在! (它不会出现在我的url – 我看到的只是本地主机:1337) req.body / req.params […]

贝宝快递结帐安全与静音阿贾克斯呼叫

PayPal的新结账让我感到不安全,用户无法在匿名方面触发虚假付款? 提供的代码看起来像这样 paypal.Button.render({ env: 'sandbox', client: { sandbox: 'AapGZeCaaDK_q_KPeG19DHnD_kd18vr6BxNe4P6uuhfTKPjIedtNEI9plyDgmzfyI-xGhbxjpv0k-Ha9', production: 'xxxxxxxxx' // u expose the key to client side? is this ok? }, payment: function() { var env = this.props.env; var client = this.props.client; return paypal.rest.payment.create(env, client, { transactions: [{ amount: { total: ($scope.number_of_uses * 9) + '.00' , currency: 'USD' }, item_list: { items: […]

错误:无法find模块的“实体/ lib / decode_codepoint.js”

我正在使用cheerio模块进行网页抓取。 它需要htmlparser2模块,安装htmlparser2后。 它给出了以下错误 – Error: Cannot find module 'entities/lib/decode_codepoint.js'

JSON数据返回{},没有任何数据

var getfiles = function (context) { var scriptPath = '/var/names/myfolder'; fs.readdir(scriptPath, function (err, files) { if (err) return context.sendJson(err, 404); var resultingJson = {}; for (var j = 0; j < files.length; j++) { subfolder = scriptPath + files[j]; console.log(files[j]);// prints art,creation fs.readdir(subfolder, function (err, fi) { //fi prints [artdetails.txt,artinfo.txt] // [creationdetails.txt,create.txt] // console.log(files[j]);// prints […]

/ bower_components不会加载页面上的依赖关系

/bower_components不起作用。 我得到404错误: GET /bower_components/jquery/jquery.js 404 我的configuration如Bower文档中所述: app.use(express.static(path.join(__dirname, 'public'))); app.use('/bower_components', express.static(__dirname + '/bower_components')); 在我的.html文件中,我有: <script src="/bower_components/jquery/jquery.js"></script> 但是没有/bower_components/jquery/jquery.js 。 有\bower_components\jquery\dist\jquery.js 。 他们是否改变了鲍尔软件包的configuration,但忘记更改文档?

如何使用茉莉花和节点从命令行testingjQuery插件?

我有我正在testing的jQuery插件。 我发现这个问题: 如何从命令行上运行JasminetestingNode.js? 但是当我运行: node_modules/jasmine-node/bin/jasmine-node –verbose –junitreport –noColor spec 我得到错误,没有定义$。 我如何包含jQuery? (现在我只testing不与dom交互的实用程序)。

webpack无法加载模块jquery

我想使用webpack在打字稿中导入jquery。 这就是我所做的。 npm init -y npm install -g webpack npm install ts-loader –save touch webpack.config.js 在文件中,我写了这个 module.exports = { entry: './app.ts', output: { filename: 'bundle.js' }, resolve: { extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'] }, module: { loaders: [ { test: /\.ts$/, loader: 'ts-loader' } ] } } 然后创buildapp.ts并写下以下内容 import $ = require('jquery'); 然后我npm install […]

如何获取当前目录名称并使用node.js将其显示在html页面上

其实我在index.js文件中有一个path名。无论何时我select目录,我都能够在node.js控制台屏幕上看到当前的目录名称。 现在,我想将该目录名称显示在template.html页面的文本框中。 任何人都可以请帮我解决这个问题? 在index.js中,在这个部分,我能够在控制台中看到path名: app.get('/files', function(req, res) { var currentDir = dir; var query = req.query.path || ''; if (query) currentDir = path.join(dir, query); console.log("browsing ", currentDir); 我的index.js: #!/usr/bin/env node var http = require('http'); var _ = require('lodash'); var express = require('express'); var fs = require('fs'); var path = require('path'); var util = require('util'); var […]