Tag: angularjs

npm安装在Yeoman-Grunt构build

我正在与yeomanbuild立一个angular度的应用程序。 我已经设置了代理和registry 我做了以下步骤。 1.npm install -g yo grunt-cli bower 2.npm install -g发生器angular度 3.mkdir yeoman-contacts && cd yeoman-contacts 4.yoangular色:app yeomanContactsApp 之后,我有以下错误 npm ERR! EEXIST, mkdir 'C:\Users\Documents\nodejs\yeoman-contacts\node_modules\grunt-contrib-imagemin\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modul g' File exists: C:\Users\Documents\nodejs\yeoman-contacts\node_modules\grunt-contrib-imagemin\node_modules\pngquant-bin\node_modules\bin-wrapper\node_modules\mout\str Move it away, and try again. npm ERR! System Windows_NT 6.1.7601 npm ERR! command "C:\\Users\\\Documents\\tools\\nodejs\\nodejs\\\\node.exe" "C:\\Users\\\Documents\\tools\\nodejs\\nodejs\\node_modules\\npm\\bin\\npm-cli.j npm ERR! cwd C:\Users\Documents\nodejs\yeoman-contacts npm ERR! node -v v0.10.7 npm […]

教程AngularJS-npm安装错误

我试图按照angularjs网站上的步骤,但我遇到了一个错误。 这是我的package.json的内容: $ cat package.json { "name": "angularjs-seed", "description": "A starter project for AngularJS", "repository": "https://github.com/angular/angular-seed", "devDependencies": { "phantomjs": "~1.9", "karma": "~0.10.4", "karma-junit-reporter": "~0.1", "karma-jasmine": "~0.1.3", "karma-ng-scenario": "~0.1", "karma-chrome-launcher": "~0.1.0", "karma-firefox-launcher": "~0.1.0", "karma-html2js-preprocessor": "~0.1.0", "karma-requirejs": "~0.1.0", "karma-coffee-preprocessor": "~0.1.0", "karma-phantomjs-launcher": "~0.1.0", "karma-script-launcher": "~0.1.0" } } 这是我尝试执行$npm install时的错误 nisevi@nisevi-IdeaPad angular-phonecat (master):$ npm install npm http GET https://registry.npmjs.org/phantomjs […]

Angular – Node Express – 大图片上传问题

我正在处理使用express.js,节点和angular度的file upload。 适用于小尺寸图像的基本function。 当我尝试上传更大的图像时,我得到了404错误。 我使用angular度file upload。 这是我的file upload编码 $upload.upload({ url: '/products/image/upload', data: { PRODUCT_ID : productId, }, file: file }).progress(function(evt){ console.log('percent: ' + parseInt(100.0 * evt.loaded / evt.total, 10)); }).success(function(data){ console.log(data); }); 这是我的快速js代码 app.post('/products/image/upload', controller.uploadProductImage); exports.uploadProductImage = function(req, res){ var fileObject = req.files.file; var newPath = ''; var newFilename = 'sample.png'; newPath = './uploads/products/' + […]

Angular $ http.post和No'Access-Control-Allow-Origin'标题

我有两个应用程序与nodejs和angularjs.nodejs应用程序有这样的一些代码: require('http').createServer(function(req, res) { req.setEncoding('utf8'); var body = ''; var result = ''; req.on('data', function(data) { // console.log("ONDATA"); //var _data = parseInput( data,req.url.toString()); var _data = parseInputForClient(data, req.url.toString()); switch (req.url.toString()) { case "/cubes": { 和这个应用程序主机上的http://localhost:4000 .angularjs应用程序主机与节点http-server模块localhost://www.localhost:3030在我的一个angularjs服务我有这样的事情: fetch:function(){ var data = '{somedata:"somedata"}'; return $http.post('http://localhost:4000/cubes',data).success(function(cubes){ console.log(cubes); }); } 但是当这个服务发送一个请求到服务器得到这个错误: XMLHttpRequest cannot load http://localhost:4000/cubes. No 'Access-Control-Allow-Origin' header is […]

在AngularJS应用程序中,可以引用bower和node文件夹中的文件吗?

我目前正在做我的第一个AngularJS应用程序,我的目录是这样设置的 app/ assets/ <css, js, images etc…> bower_components/ <various bower things> components/ <controllers, directives etc. in sub folder components> partials/ app-controller.js app.css index-async.html index.html node_modules/ <various node things> test/ <karma> bower.json package.json 我很困惑,如何凉亭/节点包适合这个等式。 我使用angular-seed git repo开始了这个项目,并且修改了结构以匹配谷歌的最佳实践结构。 Angular种子项目通过使用“bower_components / component”引用html中的文件,但是在.gitignore文件中忽略了bower_components文件夹。 如果bower_components和node组件文件夹被忽略,那么如果它们不应该与最终产品一起使用,那么在html中引用这些文件夹会不好呢?

如何从数据库dynamic添加路由到angularjs

我正在创build一个NodeJs + AngularJS应用程序。 我有酒店列表存储在数据库中。 我想根据酒店名称和基于属性ID的加载部分视图创builddynamic路线。 例如在我的数据库中,我有: HotelID HotelName 1 example hotel 2 second example hotel 3 third example hotel 在app.js我想要这样的东西 var hotelierApp = angular.module('hotelierApp', ['ngRoute', 'ngCookies', 'pascalprecht.translate', 'hotelierApp.services', 'hotelierApp.directives', 'hotelierApp.filters', 'hotelierApp.controller']); hotelierApp.run(function ($rootScope) { $rootScope.langId = 1; }) hotelierApp.config(['$routeProvider', '$locationProvider', '$translateProvider', function ($routeProvider, $locationProvider, $translateProvider) { angular.forEach(hotels, function (hotel) { $routeProvider.when(hotel.name.replace(" ","-"), { templateUrl: 'partials/property', […]

从玉传递variablesng-init不起作用

我正在尝试从angular色中传递一个对象从玉到ng-init 这:不起作用: ng-init='tables=!{JSON.stringify(tables)}' 这:扩大,但是, ng-init='tables=#{JSON.stringify(tables)}' 输出是未翻转的并填充有&quot; 小号 ng-init="tables={&quot;12&quot;:{&quot;id&quot;:…. 在这两种情况下都不更新视图。 这篇文章暗示,第一个应该工作,但正如我所说,它甚至不扩大, ng-init='tables=!{JSON.stringify(tables)}' 在源代码中显示完全相同的HTML源代码 ng-init='tables=!{JSON.stringify(tables)}'

你如何在NodeJS和Express中使用Angular包?

我通过npm install为我的Express项目安装了Angular包,但我不知道如何使用它。 如果以这种方式安装,它是如何使用的? 或者是使用Angular的唯一方法是在html页面中使用“script”来包含它?

如何将现有的AngularJS 2 Web应用程序转换为Cordova应用程序?

我有一个与Angularjs 2.0构build的Web应用程序,我想将其转换为android apk并安装在android手机上并testing。 我没有任何build立移动原生应用程序或将webapp转换为原生应用程序的经验。 我已经通过如何将现有的AngularJSnetworking应用程序转换为cordova应用程序? 任何build议/指导将有所帮助。

在mongdb中更改数据时更新angularJS视图

我的项目架构有点像这样: 我有一个移动应用程序 ,我用它来上传一张表格和一张照片。 此应用程序连接到服务器( 服务器B )。 使用这个服务器,我把照片上传到s3 ,并将表单数据保存到数据库中 。 还有另一台服务器( 服务器A ),我用它从数据库获取数据并在客户端查看这些数据。 现在的问题是 – 我想要使这个过程是实时的 。 我试图使用socket.io,但没有奏效。 我可以使用socket.io发送数据到所有的客户端,但是如何知道当数据在数据库中更改? 我正在做一些架构上的错误吗? 任何人有任何想法如何解决这种问题? 注:我使用不同的服务器,因为这两个是不同的应用程序。 如果一台服务器出现故障,对其他进程没有任何影响。