Tag: angularjs

AngularJS:如何检索Foursquare API数组数据?

我试图使用angularjs检索场馆列表。 使用console.log(data),我可以看到angularJS成功地调用了foursquare API。 但是,我如何parsing数据中的每个id元素。 例如,我想获得场地名称,场地联系和其他细节,我怎样才能使用ng-repeat标签。 var results = this; $http.get("https://api.foursquare.com/v2/venues/search?client_id=CLIENT_ID&client_secret=SECRET_KEY&v=20130815&ll=17.416471,78.438247&query=coffee") .success(function(data){ results = data; console.log(results); }) 检查这个链接样本json数据: https : //developer.foursquare.com/docs/explore.html#req=venues/trending%3Fll%3D40.7,-74 提前致谢!

量angular器JS预处理器

我知道在Karma中有使用预处理器的选项,但是在量angular器中,我看不到同样的东西。 我目前正在使用onPrepare选项,但我想知道是否有可能/目前是否有一种方法来让npm模块总是先运行(基本上与onPrepare相同),但通过configuration,而不必做任何要求等

Yeoman构build的angular色应用程序不部署引导字体到heroku

前面,我已经解决了这个错误。 这只是其他人碰到的参考。 我已经使用本指南部署了一个Yeoman构build的应用程序heroku: http : //www.sitepoint.com/deploying-yeomanangular-app-heroku/ 除了需要删除线路之外,指南几乎完美无缺: app.use(express.logger('dev')); 一旦部署,与引导包装glyphicons正在返回404。经过多次挖掘我意识到: dist/bower_components 文件夹没有被添加到git存储库,因为我的.gitignore里面有这条线: // .gitignore file // node_modules .tmp .sass-cache bower_components // This line! 删除意味着提交我的整个bower_components文件夹到Git仓库,我没有看到必要的。 相反,我将以下内容添加到.gitignore中: // .gitignore file // node_modules .tmp .sass-cache bower_components !dist/bower_components 现在,dist / bower_components被添加到资源库中,并按照预期部署到Heroku。

哟angular度错误?

我在我的Mac(OS X 10.9)上安装了Yeoman,我试图运行哟angular 。 我得到以下错误: path.js:384 throw new TypeError('Arguments to path.join must be strings'); ^ TypeError: Arguments to path.join must be strings at exports.join (path.js:384:15) at Generator.<anonymous> (/usr/local/lib/node_modules/generator-angular/common/index.js:26:34) at Generator.setupEnv (/usr/local/lib/node_modules/generator-angular/common/index.js:29:3) at /usr/local/lib/node_modules/generator-angular/node_modules/yeoman-generator/lib/base.js:387:14 at processImmediate [as _immediateCallback] (timers.js:374:17) 软件版本 节点0.11.13 npm 1.4.26 哟1.1.2 凉亭1.3.9 grunt-cli 0.1.13 哟也说有一个更新为哟(1.2.1),但不会安装npm更新-g哟 我也尝试在另一台机器上安装相同的结果(遵循yeoman指南http://yeoman.io/codelab/setup.html ) 如果有人能帮助我,我会非常感激。

将后端Express会话variables传递给Angular

当前代码: <div ng-controller="HeaderCtrl" class="header"> <div class="logo">intquest</div> <div ng-if="signed_in" class="header-actions"> <a href="/#/random">Random</a> <a href="/#/add">Add question</a> </div> <div ng-if="!signed_in" class="header-actions"> <a href="/#/register">Register</a> <a href="/#/login">Login</a> </div> </div> 我想以某种方式将我的Express会话var传递给$scope.signed_invariables。 因为这是一个HTML而不是Jade模板,我不能使用JSON.stringify ,我没有后端API,所以我不认为我可以做一个$http或资源请求,我应该怎么做这个? 什么是最佳实践?

点击button后使用angularjs,nodejs,expressjs下载Csv文件

我想在前端下载.csv文件。 这是我的代码: $http.get('/entity/consultations/_/registerationReport' ) .success(function (data) { myWindow = window.open('../entity/consultations/_/registerationReport', '_parent'); myWindow.close(); }); 我用json2csv转换器写入CSV文件。 json2csv({data: report, fields: fields}, function (err, csv) { if (err) throw err; res.setHeader('Content-Type', 'application/csv'); res.setHeader("Content-Disposition", "attachment; filename=" + "Report.csv"); res.end(csv, 'binary'); }); 但它在浏览器上打印csv文件的数据而不是下载csv文件。

如何创build新的应用程序项目,而无需一次又一次下载和安装npm模块?

我用-g安装了大部分的NPM模块 但是,我发现每当使用Yeoman创build一个新的应用程序项目(例如:angular project)时,我都会看到npm模块会再次下载并安装在本地node_modules文件夹中。 我认为这是非常浪费,相同的模块下载并复制每个新的项目。 每个新项目的大小都在160MB左右。 有没有办法只在本地下载新项目中的全局npm node_modules文件夹中没有的模块? 无论如何,要自动创build从本地node_modules文件夹到全局安装的npm模块的符号链接? 这可能吗? 如何设置?

如何从Node服务器获取请求pathvariables值到AngularJS控制器

我想通过使用ExpressJS发送到节点服务器的链接,从电子邮件客户端(例如Gmail)中获取tokenpathvariables的值,然后在控制器( MyController )中使用该值。 服务器正在显示视图reset.ejs并将传递的token值作为parameter passing给它。 以下是上述情况的代码: server.js(ExpressJS) app.get('/reset/:token', function (req, res) { User.findOne({ resetPasswordToken: req.params.token, resetPasswordExpires: { $gt: Date.now() } }, function(err, user) { if (!user) { res.render('reset', { title: 'Foo in a Bar', token: req.params.token, invalidTokenMsg: "Password reset token is invalid or has expired" }); } else { res.render('reset', { title: 'Foo in a […]

使用node.js和socket.io进行套接字authentication(使用DaftMonk的generator-angular-fullstack)

我正在使用DaftMonk的generator-angular-fullstack作为默认设置,我发现自己需要使用套接字authentication,所以我在socketio.js和Angular服务上启用了“socketio-jwt”。 这是我的Angular服务的样子: /* global io */ 'use strict'; angular.module('myApp') .factory('socket', function(socketFactory, Auth) { // socket.io now auto-configures its connection when we ommit a connection url var ioSocket = io('', { // Send auth token on connection, you will need to DI the Auth service above query: 'token=' + Auth.getToken(), path: '/socket.io-client' }); var socket = […]

JADE和ng-class

我在导航栏中有以下expression,我无法在JADE中工作。 这似乎对我有效。 li(ng-class="{'active' : true}"): a(href='#') INFO SHEET 我在这里做错了什么? 它根本不应该应用这个类。 如果我改变这只是… li(class='active'): a(href='#') INFO SHEET … 奇迹般有效。 HTML呈现如下所示: <li ng-class="{'active' : true}"><a href="#">INFO SHEET</a></li> 编辑:我也试过以下内容: li(ng-class='{active: isActive("/")}'): a(href='#') INFO SHEET 活动在根控制器上定义如下: $scope.isActive = function(path){ return (path === $location.path()); }; 我用chrome在函数的主体上设置了一个断点,并且它从不中断。 控制台中也没有错误。 就像Angular就是因为某种原因没有解释它。 其他信息…. Angular版本是1.3.0