Tag: angularjs

使用pdfMake通过Node Express将PDF内容返回给浏览器

我正在使用pdfmake库在我的节点快递应用程序中生成PDF文档,并希望将这些文件直接发送回客户端,以触发浏览器自动下载文件。 作为一个参考点,我一直在使用下面的例子来表示我的中间件: https://gist.github.com/w33/38c5e0220d491148de1c https://github.com/bpampuch/pdfmake/issues/489 我select了发送缓冲的响应,所以我的中间件的关键部分如下所示: function createPDFDocument(docDefinition, callback) { var fontDescriptors = { Roboto: { normal: './src/server/fonts/Roboto-Regular.ttf', bold: './src/server/fonts/Roboto-Medium.ttf', italics: './src/server/fonts/Roboto-Italic.ttf', bolditalics: './src/server/fonts/Roboto-MediumItalic.ttf' } }; var printer = new Printer(fontDescriptors); var pdfDoc = printer.createPdfKitDocument(docDefinition); // buffer the output var chunks = []; pdfDoc.on('data', function(chunk) { chunks.push(chunk); }); pdfDoc.on('end', function() { var result = Buffer.concat(chunks); callback(result); […]

刷新路由参数后无法加载索引

我为这个可能的网页创build路由 angular.module("ui",[]).config(function($routeProvider,$locationProvider,$httpProvider) { $routeProvider.when('/home', { templateUrl: 'home.html' }) .when('/login', { templateUrl: 'login.html' }) .when('/sign_in', { templateUrl: 'create_account.html' }) .when('/profil', { templateUrl: 'profil.html' }) .when('/note/:id', { templateUrl: 'view_note.html' }) .when('/editNote/:id', { templateUrl: 'edit_note.html' }) .otherwise({ redirectTo: '/home' }); $locationProvider.html5Mode(true); }); 和服务器端代码(expressjs) app.get('/*', function(req, res) { res.sendFile(__dirname + '/views/index.html') }); app.get('/note/:id', function(req, res) { res.sendFile(__dirname + '/views/index.html') […]

使用Private Repo NPM Package作为依赖源文件需要编译

任何地方都找不到好的答案。 我们有一个私人的Github仓库,它是一个Angular模块,需要构build源代码(concat,minified等),并将其作为依赖项使用或安装在dist文件中。 笔记: dist被忽略,所以它永远不会驻留在Github上(试着跟踪这个,与几个开发者的冲突太多了) 我们目前正在使用post安装钩子来构build依赖包的源代码(这似乎不是正确的做法,也强制项目使用依赖包来具有必要的构build依赖) Q什么是正确的方式(或常见的方式)来build立一个私人回购npm包依赖,导致dist文件夹与正确的内置文件?

Angular 2 polyfills麻烦

所以我有一个硬盘故障,失去了一切,但当然github救援。 我最近完成了我的第一个Angular 2项目,并做了一个git克隆来恢复它,每次我尝试运行服务器我得到这个错误… ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'newLine' of undefined at Object.getNewLineCharacter (D:\GitHub\sandbox\meadowbrook_acres\angular-src\node_modules\typescript\lib\typescript.js:8062:20) at Object.createCompilerHost (D:\GitHub\sandbox\meadowbrook_acres\angular-src\node_modules\typescript\lib\typescript.js:44978:26) at Object.ngcLoader (D:\GitHub\sandbox\meadowbrook_acres\angular-src\node_modules\@ngtools\webpack\src\loader.js:338:33) @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts ./src/polyfills.ts中的错误模块构build失败:TypeError:无法读取Object.getNewLineCharacter(D:\ GitHub \ sandbox \ meadowbrook_acres \ angular-src \ node_modules \ typescript \ lib \ typescript.js)中未定义的属性'newLine' (D:\ GitHub \ sandbox \ meadowbrook_acres):8062:20)在Object.createCompilerHost(D:\ GitHub \ sandbox \ […]

http-proxy-middleware:无法将localhost:9000redirect到本地主机:8888从nodejs到JettY

我有一个Node.js(AngularJS应用程序)应用程序,它托pipe在localhost:9000上。 另一部分(遗留的 – GWT superdev模式 – JeTTy)托pipe在localhost:8888。 我想configurationhttp-proxy-middleware,使得任何进入localhost:9000(NodeJS)的东西都应该被redirect到localhost:8888(JeTTy),并具有以下规范:(应用程序有3个端点): https:// localhost:9000 / product – > http://127.0.0.1:8888/product https:// localhost:9000 / servlets / my_servlet1 – > http://127.0.0.1:8888/servlets/my_servlet1 https:// localhost:9000 / admin – > http://127.0.0.1:8888/admin http-proxy-middleware设置如下: var proxy = proxyMiddleware(['/ product','/ admin','/ servlets'],{ 目标:“http://127.0.0.1:8888”, changeOrigin:true, xfwd:true }); var app = connect(); app.use(代理); 代理如下: ##节点脚本/ serve.js [HPM] Proxy created:['/ product,'/ […]

Express和Angular路由

编辑:大家好,我的代码是正确的。 我不得不使用$ locationProvider从Url中删除“#”。 这是问题;) 我正在学习一个简单的拍卖应用程序的平均堆栈。 我有一些问题了解如何expression和angular度路由一起工作。 我的节点服务器,正在服务这个文件,app.js var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var routes = require('./routes'); var mongoose = require('mongoose'); var app = express(); mongoose.connect('localhost:27017/auction'); // view engine setup app.set('views', path.join(__dirname, '/views')); app.set('view engine', 'jade'); app.use(favicon(path.join(__dirname, […]

我的ng-click和ng-if在托pipe之后不起作用

朋友,我正在构build一个MEAN堆栈应用程序。 *我已经在Heroku和mLab的数据库中托pipe了应用程序。 当我在本地运行它时,一切都很好。 每当我在本地运行它时,一切正常,每个脚本都正常运行。 我想做的事? 我需要隐藏另一个部门点击部门。 每个部门都与另一个具体部门相连。 如果点击了分区连接div应该显示,而前一个应该隐藏。 一切顺利,直到我部署我的变化。代码不起作用,所有的div一次出现。 代码不起作用。 我已经使用angular和jQuery 要隐藏我已经使用angularng-if的部门 要调用我已经使用ng-click的函数。 这是我的代码: var app = angular.module('myApp', []); app.controller('eduController', function($scope, $http) { $scope.info = 1; $scope.info2 = 0; $scope.info3 = 0; $scope.hideInfo = function() { $scope.info = 1; $scope.info2 = 0; $scope.info3 = 0; } $scope.hideInfo2 = function() { $scope.info = 0; $scope.info2 = […]

如何使用angular度追加表单字段以及如何在数据库中插入值

我使用express和mongoose来保存mongodb中的数据。 我正在创buildNode API,下面是我的Mongo Schema。 var bookSchema=new Schema({ subject_name:{type:String}, books:[{book_name:String, book_author:String}] }); 我的HTML视图如下 我想在一个主题名称上添加多个书籍。 所以我想知道如何使用Angularjs多次添加Books部分,以及如何在mongodb中存储它的值。 我期望的结果是这样的: 请让我怎么做到这一点。 提前致谢。

AngularJS和NodeJS http-server:重写URL

我使用NodeJS http-server来编写AngularJS应用程序。 我有一个问题。 当我尝试直接访问浏览器中的URL时,Angular不会拦截URL来显示内容。 如果我手动键入URL: http : //127.0.0.1 : 8080/ #! /客户它的工作,但不是当我直接input: http : //127.0.0.1 : 8080 /clients 我想要http://127.0.0.1:8080/# ! 作为http服务器中的默认值。 我在AngularJS中使用html5模式和哈希前缀: $locationProvider.html5Mode(true); $locationProvider.hashPrefix('!'); 有没有一种方法来重写http-server的URL与地址之前的默认/#!/ ?

无法加载资源:服务器在angular.js中的状态为404(未find)

我创build了一个war文件,并试图将其部署在bluemix上。 App.js var express = require("express"); var app = express(); var path = require("path"); app.use("/", express.static(__dirname)); app.get('/', function(req, res) { res.sendFile(path.join(__dirname + '/ingestion-scala-apidocs/index.html')); }); app.set('port', process.env.PORT); console.log(port); manifest.yml applications: – name: connectors path: connectors.war memory: 900M instances: 1 host: connectors domain: mybluemix.net 推到bluemix并点击主机名后,我得到以下错误: Failed to load resource: the server responded with a status of 403 […]