Tag: angularjs

错误:npm不安装软件包

C:\Users\Wallay Masroof\Desktop\quickstart-master>npm install npm WARN deprecated express@2.5.11: express 2.x series is deprecated npm WARN deprecated connect@1.9.2: connect 1.x series is deprecated npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! Windows_NT 10.0.10586 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" […]

错误地被激活$ http.post不止一次

编辑: 我可能会问错误的问题。 我今天上午简化了Node.js代码,问题停止了。 这个问题似乎与使用deasync模块有关: var done = false; processGridCell(cell, layers, rowCount, colCount, datasetObject, function() { done = true}); deasync.loopWhile(function(){ return !done }); 我猜deasync是用来防止function内存不足。 每次调用processGridCell都会保存一个MongoDB文档,它被称为〜12,000次。 因为主节点线程永远不会产生asynchronousmongoose.save +callback的时间,所以被保存的对象从不被GCC处理,并且进程内存不足。 我没有看到使用deasync的简单方法。 我也不知道为什么使用deasync会导致客户端发出另一个POST请求,为什么删除它会阻止这个请求的发生。 我已经inheritance了一个节点/angular度应用程序,我已经负责修复了一下。 发生什么事是,当一个表单被提交时,它会调用一个Node.js函数,运行需要10-20分钟。 几分钟后,虽然我可以看到Node函数仍在运行,但是第二次从客户端提交相同的发布请求。 我没有能够找出原因。 另外,我在POST请求之前logging信息,但是它只logging第一次,而不是第二次。 这是代码,显着删节。 HTML: <header class="text-center" data-ng-include="'/modules/core/views/header.client.view.html'"></header> <section> <div class="get-grid-form"> <h2>Input Grid Size</h2> <hr> <form name="gridSizeForm" ng-controller="gridSizeCtrl" data-ng-submit="submitGridInput()" ng-class="{'has-error': gridSizeForm.myDecimal.$invalid}" > <div class="grid-input-form"> <p>Other […]

angular色路由提供者在nodejs上进行身份validation

我目前正在用angular-js,nodejs和mongodb后端尝试一下我的第一个应用程序。 这个应用程序和它的URL是由ngRoute从angular度来pipe理的。 在这个应用程序中有一个小小的pipe理区域进行身份validation(基于nodejs的客户端会话)。 这工作到目前为止很好。 身份validation适用于由nodejspipe理的URL,但不适用于routeProvider的身份validation。 提供者看起来像这样: app.config(['$locationProvider', '$routeProvider', function ($locationProvider, $routeProvider) { $routeProvider.when("/main", { templateUrl: "app/main/landing.html", controller: "MainController" }) .when("/admin", { templateUrl: "restricted", controller: "AdminController" }) .when("/login", { templateUrl: "app/login/login.html" }) .otherwise({redirectTo: '/main'}); }]); 限制区域(/ admin)调用一个get服务器并发送view.html如果用户有效: app.get('/restricted', function (req, res) { if (!req.session_state.user) { res.res.status(302).redirect("/login");//Does not really work, should redirect to login, but endless loop […]

在Javascript中实现时间间隔树

我正在寻找用Javascript编写的Interval-Tree实现。 search了一下,发现没有用JS写的东西。 我发现的是NodeJS的项目,它实际上不在客户端工作(我错了?): 间隔-tree2 JavaScript的algorithm 你用Javascript中的间隔树实现家庭吗? 谢谢。

npm start命令不起作用,并显示mongoose的弃用函数错误

我正在创build一个express和有angular项目。 我会告诉你的步骤,所以你可以看到,如果问题是一个缺less的命令或否: 我开始在全球安装express: npm install -g express 然后我创build了我的快速项目: express –view=hbs project_name 我安装了依赖关系: npm install 我安装了所有angular4需要的依赖关系: npm install –save @angular/cli@latest npm install –save @angular/core @angular/common @angular/http @angular/router @angular/compiler @angular/compiler-cli @angular/platform-browser @angular/animations @angular/platform-server … 我安装了mongodb和mongoose: npm install –save mongoose 现在,我试图运行命令npm start ,并且出现以下错误: 0信息它的工作,如果它结束与确定1详细cli ['C:\ Program Files \ nodejs \ node.exe',1详细cli 'C:\ Users \ pc \ AppData \ […]

数组元素是未定义的,即使在推入元素后

我正在构build一个video保存服务作为一个项目,并从数据库response.array[]获取用户的已保存videoarrays,然后将videoId推入显示arraysvideo[]但显示相应的videoId使用console.log()它不断未定义。 我有如下的代码片段。 let video = []; this.service.nextVideo().subscribe( response => { response.array.forEach(element => { video.push(element.videoId); }); }) console.log(video[0]); //Output is undefined 完整的代码片段就像这样 nxtVideo(){ let video = []; this.service.nextVideo().subscribe( response => { response.array.forEach(element => { console.log(element.videoId);//Display's video id video.push(element.videoId); }); }) console.log(video[0]); //Output undefined console.log(video); //Output shows all elements but on accessing specific elements it shows undefined […]

在Windows 7中重新启动npm启动错误

如何解决这个问题。 在这里,我需要重新解决这个问题在Windows 7 64位。 我在Windows 7中安装nodejs并打开我input的命令提示符 npm版本 'CALL "C:\Program Files\nodejs\\node.exe" "C:\ProgramFiles\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,operable program or batch file. { 'angular-quickstart': '1.0.0', npm: '3.10.10', ares: '1.10.1-DEV', http_parser: '2.7.0', icu: '58.2', modules: '48', node: '6.11.4', openssl: '1.0.2l', uv: '1.11.0', v8: '5.1.281.108', zlib: '1.2.11' } 而我创build项目文件夹我安装angularjs时,我安装npm其工作正常,但我给了像这样的命令 E:\project\Demo>npm start 'CALL "C:\Program […]

用指定的date格式导出excel表格单元格

我导出空的Excel表单与一些标题值。 在那个excel工作表中,我想为date字段设置date格式,如(mm / dd / yyyy)。 如何设置该单元格的指定格式。 在这里我定义了Excel单元格: var InstructionSheet = workbook.addWorksheet('Instruction'); InstructionSheet.getCell('A22').value = 'F: Start Date'; InstructionSheet.getCell('A22').font = { name: 'Calibri', bold: true }; worksheet.columns = [ { header: 'ProjectName', key: 'id', width: 10 }, { header: 'UniqueID', key: 'name', width: 40 }, { header: 'Name', key: 'name', width: 40 }, { header: 'ResourceNames', […]

从angular度读取nodejs中的cookie

我正在使用angular和nodejs创build一个项目。 我的代码有问题。 我在nodejs中设置cookie,并想读取angular度的一面。 我不知道我怎么能做到这一点。 这里是设置cookie cookies = {expire : new Date(new Date().getTime()+20*60*1000), maxAge : 600000, httpOnly : true, secure : true}; res.cookie('cookiename', "cookievalue", cookies); 在angularjs中: console.log(document.cookie) //get blank value 请帮忙

节点的Js – 我需要ref或embedded我的Mongoose架构?

我知道在mongoose schema有很多关于ref和embed模式的讨论。 我有点学习node ,我有一个RDBMs的背景。 我正在和mongoose一起工作。 我有一个非常简单的场景,我已经实现了它。 我卡住的地方是要么使用embed或ref 。 脚本 我的情况是,我有两个模型product和categories 。 它们之间的关系是many to many 。 首先让我告诉你我的模型。 类别架构 const mongoose = require('mongoose'); //function to call monggose schema const CategorySchema = mongoose.Schema({ category_name: { type: String, required: true } }) const Category = module.exports = mongoose.model('Category', CategorySchema); 产品架构 const mongoose = require('mongoose'); const ProductSchema = mongoose.Schema({ product_name: […]