Tag: angularjs

是否可以将EJSvariables传递给Angular ng-repeatfilter?

我有一个configuration文件页面,可以使用<%= user.local.name%>以纯文本格式显示用户名 – 这使用Mongoose查询数据库。 有没有一种方法可以将该值传递给Angular ng-repeatfilter? 这工作: <tr ng-repeat="x in users | filter:{'name':'Bob'}:true"> 但是这不起作用: <tr ng-repeat="x in users | filter:{'name':<%= user.local.name %>}:true"> 我知道'鲍勃'是被渲染的价值,因为我显示在页面的其他地方。 它与括号内的variables有什么关系?

ng重新安装应用程序后,无法写入EPERM(无法写入)

我使用ngBoilerplate作为我的应用程序的基础。 ngbp正在使用ngAnnotate和grunt-ng-annotate来标记应用程序。 一切工作正常,直到我不得不格式化我的电脑,并从我的git帐户重新安装应用程序。 我已经使用npm install,bower install&grunt install再次安装了所有东西,并且所有东西似乎都被正确安装,所有的依赖关系都存在,所有的路由都是正确的。 当我运行“grunt watch”时,构build过程正常工作。 当我运行“grunt build”时,构build过程在ngAnnotate上失败,它每次停止在不同的文件上,所以问题与错误信息中显示的文件无关 运行“ngAnnotate:compile”(ngAnnotate)任务 警告:无法写入“build / src / app / somefile.js”文件(错误代码:EPERM)。 使用–force继续。 由于警告而中止。 这是ngAnnotateconfiguration(编辑器删除一些图表,请参阅https://gist.github.com/orzilca/f8a7312587a710094342 ): ngAnnotate:{ 编译:{ 文件:[ { src:['app_files.js(修剪,见上面的链接)'], cwd:'build_dir', dest:'build_dir', 展开:true } ] } }, 这是app_files.js数组: app_files:{ js:['src / ** / *。js','!src / ** / *。spec.js','!src / assets / ** / *。js'] } 完整的grunt文件在这里: https […]

访问客户端的根文件夹

我是开发服务器端应用程序的新手。 我在MongoDB中有一个集合,它存储了存储在根目录/uploads文件中的文件的名称。 我必须使用angular度在客户端下载它们。 但是使用ng-src或简单的src退出ng-repeat我得到一个404错误。 有没有办法让客户端访问目录的文件? <div class="row jumbotron" ng-repeat="item in items"> <div class="col-sm-1"> <img ng-src="../../../uploads/{{item.logo}}"> </div> <div class="col-sm-8"> <h4>{{item.name}}</h4> </div> <div class="col-sm-2 pull-right"> <button type="button" class="btn btn-lg btn-info" ng-click="showModal($index)">Edit</button> </div> </div> 也尝试通过../提供文件 – 404(Not Found) <div> <img src="../../../uploads/38809344bac1a3a77c5d1e0493763849.png"> </div>

我怎么能在angularjs中的服务的两个function之间传递数据

我正在尝试创build一个多步表单,其中我做了两个不同的视图和两个不同的控制器,我试图将数据从视图1传递到在服务中定义的函数,然后试图在同一服务的另一个函数中访问这些数据。 以下是我写的服务:service.js var EmployeeService = angular.module('EmployeeService',[]) .service('AddEmployee', function($resource){ var Employee = $resource('/api/meetups'); var emp_email=""; this.email = function(email){ var emp_email = email; return emp_email; }; this.personal = function(first_name){ var employee = new Employee(); employee.email = emp_email; employee.first_name = first_name; employee.$save(); }; }); 我试图将email函数的emp_emailvariables存入个人函数。 但我不能这样做。 有没有什么办法可以在我的第二个函数中使用emp_emailvariables。 以下是使用服务的控制器: app.controller('mainCrl', ['$scope', '$resource', '$location', 'AddEmployee', function ($scope, $resource, $location, AddEmployee){ […]

如何将节点/快车应用程序的值传递给AngularJS控制器

我正在开发一个基于mean.js锅炉板的应用程序。 在我的一个angular控制器中,我需要“知道”应用程序是否在开发,testing或产品中运行。 当宿主节点应用程序启动时,这通过NODE_ENV环境variables指示,所以节点知道它在哪里运行。 如何将这些知识传递到应用的angular度部分?

NodeJs和Mochatesting响应

是否有可能使用摩卡来testingNodeJs的响应? GET请求是使用$ http从AngularJs到NodeJs。 在请求成功的时候调用这个函数: var successCallback = function (data) { var SUCCESS_STATUS_CODE = 200; response.set('Content-Type', 'application/json'); response.send({ statusCode: SUCCESS_STATUS_CODE, data: data }); }; 我试图用Sinon来窥探这个function,而且Mocha也检查了这个请求,但是我不能让它们工作。 编写一个testing来检查“response.send”输出的最好方法是什么?

如何用量angular器解决'你的系统失败'的错误?

我正在开发一个单一的Web应用程序,按照这个教程: https://docs.angularjs.org/tutorial 是什么原因使我产生了很大的问题,显然是量angular器端到端testing工具的正确configuration。 我已经完成了前面的所有步骤(安装npm,bower,jasmine等)。 然而,每当我尝试做相同的量angular器(当然是在适当的项目文件夹),控制台输出这个: angular-phonecat@0.0.0 protractor C:\Users\Michał Szydłowski\angular-phonecat > protractor test/protractor-conf.js util.puts: Use console.log instead Using ChromeDriver directly… [launcher] Error: Could not find chromedriver at C:\Users\Michał Szydłowski\angu lar-phonecat\node_modules\protractor\selenium\chromedriver.exe npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs \\node_modules\\npm\\bin\\npm-cli.js" "run" "protractor" npm ERR! node v0.12.3 npm ERR! npm v2.9.1 npm ERR! code ELIFECYCLE […]

request.body总是空的多部分表单数据

从浏览器发送的请求中,我有以下内容: Remote Address:127.0.0.1:80 Request URL:http://doctor.com/api/v2/chat/message Request Method:POST Status Code:501 Not Implemented **Response Headers** view source Access-Control-Allow-Headers:Content-Type,X-Requested-With Access-Control-Allow-Methods:POST, GET, PUT, DELETE, OPTIONS Access-Control-Allow-Origin:* Connection:keep-alive Content-Length:61 Content-Type:text/html; charset=utf-8 Date:Wed, 24 Jun 2015 11:16:33 GMT ETag:W/"3d-70662653" X-Powered-By:Express **Request Headers** view source Accept:application/json, text/plain, */* Accept-Encoding:gzip, deflate Accept-Language:en-US,en;q=0.8 Cache-Control:no-cache Connection:keep-alive Content-Length:39235 Content-Type:multipart/form-data; boundary=—-WebKitFormBoundary3qsbh041bbj3MYfd Cookie:serviceToken=558a86bb69f3197ab93fd64c DNT:1 Host:doctor.com Origin:http://doctor.com Pragma:no-cache Referer:http://doctor.com/platform/chat […]

Node.js应用程序中的Angular.js特性

我有一个已经开发了几个星期的node.js应用程序。 我想添加像无限滚动的某些function,在node.js中的包也需要angular.js。 所以,我想我会继续添加angular.js支持,以便通过angular.js页面可以提供一个页面(以及其他需要这种支持的页面)。 通过互联网上可用的基本示例,我在/ views目录中创build了一个listAll.jade文件(如我使用express-jade)。 以下是它的样子: html(ng-app='demoapp') head title List All Entries! link(href='//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css', rel='stylesheet') script(src='http://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js') script(src='js/listAllEntries.js') body(ng-controller='GetAllEntries') div(ng-repeat='post in posts') | {{post}} 然后在/ public / js目录里面,我添加了一个listAllEntries.js文件,下面是它的内容: var express = require('express'); var angular = require("angular"); var app = angular.module('geniuses', []); app.controller('GetAllGeniuses', [ '$scope', function($scope){ // $scope.test = 'Hello world!'; console.log("Here?…") $scope.posts = [ 'post 1', 'post […]

不能POST / api节点

我无法从AngularJs表单向我的MongoDB数据库发布响应。 这里是代码片段 控制器 : angular.module('myapp') .controller('AddCtrl', function($scope, $alert, Event) { $scope.addEvent = function() { Event.save({ eventName: $scope.eventName }).$promise .then(function() { $scope.eventName = ''; $scope.addForm.$setPristine(); $alert({ content: 'Event has been added.' }); }) .catch(function(response) { $scope.eventName = ''; $scope.addForm.$setPristine(); $alert({ content: response.data.message }); }); }; }); 表单模板(html) : <div class="container"> <div class="panel panel-default"> <div class="panel-heading">Add Events</div> […]