Tag: angularjs

angular度js不是呈现在玉(与node.js)

我面临的一个问题是,我的Angularjs没有呈现或加载我的Jade布局。 不知何故手写笔正在完美工作。 我没有找出原因。 我还是玉器,手写笔和尖angular的初学者 以下是我的代码: index.jade !!! 5 html(ng-app='ng-app') head script(src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js') script(src='https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-resource.min.js') script(src='https://cdn.firebase.com/v0/firebase.js') script(src='http://firebase.github.io/angularFire/angularFire.js') script(type='text/javascript', src='angular.js') link(rel='stylesheet', href='style.css') body .addressBook(ng-controller='addressBook') h1 Address Book table(width='710px', border='0', cellspacing='0', cellpadding='0') tr.title(height='35px', align='left') td(width='130') Name td(width='180') Email td(width='210') Address td(width='80') Mobile tr.details(ng-repeat='contact in contacts') td {{contact.name}} td {{contact.email}} td(style='padding-bottom: 30px;') {{contact.address}} td {{contact.mobile}} angular.js function addressBook($scope) { $scope.contacts = […]

angularJS自动引导和手动引导失败的模块

我的模块定义如下: //controller.js var app; app = angular.module('toDoApp', []); app.controller('toDoCtrl', function($scope) { $scope.appTitle = 'ToDo List App'; $scope.toDoText = ''; }); 我试着用两种方式来引导我的模块,第一个是自动的: <html ng-app ="toDoApp" ng-controller="toDoCtrl"> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js" </script> <script src="controller.js" </script> … </html> 我尝试的第二种方法是手动引导它: <html> <script src= "https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js" </script> <script src="controller.js" </script> <script>angular.bootstrap(document, ['toDoApp']);</script> … </html> 我收到的错误是:[13:40:28.640]错误:无模块:toDoApp @ https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js:18 我试过这个,但是没有解决我的问题。 我也运行在本地服务器上使用node.js(我不认为是问题…) // server.js var […]

问题与AngularJS教程step_02

我在这个url上有一个AngularJS教程step_02的问题。 http://docs.angularjs.org/tutorial/step_02我已经在Ubuntu 12.04上安装了nodejs,karma和jasmine,并且可以成功运行unit testing。 但是有问题。 testing没有完成执行。 屏幕上显示以下文本:Chrome 31.0.1650(Linux)空闲。 控制台说testing是成功的。 这是来自控制台的回应: georgi@sepulcher:~/Documents/angular-phonecat$ ./scripts/test.sh Starting Karma Server (http://karma-runner.github.io) ——————————————————————- INFO [karma]: Karma v0.10.9 server started at http://localhost:9876/ INFO [launcher]: Starting browser Chrome INFO [Chrome 31.0.1650 (Linux)]: Connected on socket _yexf_t1tbbNjtj4p9dz Chrome 31.0.1650 (Linux): Executed 1 of 1 SUCCESS (0.299 secs / 0.035 secs) 但testing永远不会结束。 我将不胜感激任何帮助和想法为什么发生这种情况

我怎样才能克隆一个窗口服务器端使用jQuery?

我目前使用Node.js和jsdom运行AngularJS服务器端。 它工作得很好,但我试图通过在AngularJS作用域应用到页面之前caching由jsdom生成的DOM来优化性能。 在应用给定请求的AngularJS范围之前,我试图克隆我的cachingDOM。 目前,我通过使用jQuery(服务器端)克隆caching的DOM: var clone = cachedWindow.$("html").clone(); // This part works fine 然后,我使用jsdom创build了一个新的窗口,其中没有html标签内容(快速): jsdom.env( '<!doctype html><html></html>', injectedScripts, // This is where I inject AngularJS, which works fine function(errors, newWindow) { newWindow.angular.bootstrap(newWindow.document, ['ngView']); newWindow.$("html").replaceWith(clone); // This part does not work } ); 问题来自newWindow.$("html").replaceWith(clone); 这会产生这个错误: { code: 4, message: 'Wrong document' } 我理解这个问题是因为我试图用一个来自另一个文档( cachedWindow )的DOM元素replace一个文档( newWindow […]

Express:使用ejs时找不到静态文件

我想我所有的请求被redirect到位于Views文件夹中的index.ejs视图。 在我的routes.js文件中,我添加了这个: module.exports = function (app) { app.get('/', function(req, res) { res.render('index', {title: "TODO"}) }); } 索引视图包含所有页面的标记,因为它将是一个SPA,所以我将在客户端dynamic交换视图。 问题是,我引用脚本位于公用文件夹中,他们没有find,我得到一个404: script src="public/app/app.js"></script> 我想这是因为Express不知道如何服务器文件。 我已经指定公用文件夹中的所有内容都应该是静态文件: app.use(express.static(config.root + '/public')) 现在,如果我不使用ejs模板,并且如果我在公用文件夹而不是视图中使用index.html文件,它工作正常。 我只需要这样做: app.get('*', function(req, res) { res.sendfile('./public/index.html'); }); 但是我想利用ejs模板来添加bundle到页面,而不是逐个添加脚本。 那么我的代码有什么问题? 我怎样才能解决404文件的JavaScript文件?

在r.js构build文件中加载ngmin失败

我试图在requirejs的ngmin中使用ngmin ,但由于某种原因,我无法使其工作。 我已经通过全局和本地npm安装ngmin和requirejs ,这些选项都不会在onBuildRead()正确加载ngmin 。 我也导出了NODE_PATH ,但是这也没有帮助。 构build文件没有提供隔离问题的钩子函数,但我不是一个nodejs专家,所以我不知道如何进一步解决这个问题。 任何帮助表示赞赏。 ({ mainConfigFile: './static/js/boot.js', baseUrl: './static/js', name: 'boot', include: 'require.js', out: './static/js/main-built.js', normalizeDirDefines: 'all', onBuildRead: function (moduleName, path, contents) { var ngmin = require('ngmin'); console.log(ngmin); // ngmin is undefined return ngmin.annotate(contents); // no method annotate of undefined } })

Angular with CoffeeScript和Jade for前端,Node,Express和CoffeeScript用于后端

我即将开始在MS环境之外开发Web应用程序。 一直在search不同的技术栈,看看最吸引人的地方。 经过大约一周的search,探索,看着一大堆PluralSitevideo,我开始非常喜欢下面的组合的想法: 结合使用Node.js和Express框架,使用CoffeeScript作为主要语言来开发后端 使用AngularJS和Jade模板一起使用CeffeeScript作为主要语言来开发前端SPA。 我的问题是:我的两个select都是完全有效的吗?

GruntJS可configuration的首次运行

我正在开发一个angular度演示应用程序,我想自动化很多事情。 这是一个样板,虽然是一个更复杂的,我想要一个configuration文件,其中我们将API键和其他东西,我希望该文件由Grunt与用户交互当项目是第一次开始。 就像是: grunt build – 它应该直接在控制台询问用户API密钥,这将被插入configuration文件,我为整个应用程序定义一些全局常量。 Grunt有没有这样的function的例子?

显示由nodejs中的express显示的图像

我使用sendfile来从本地硬盘在node express中使用像: app.get('/data/getImage/:Id', function (req, res) { console.log(req.params.Id); res.sendfile('C:\\defaultimg.png', function(error){ if(error) console.log(error.message); else console.log('File transferd successfully.'); }) }); 我在angular度上调用这个方法,并得到像这样的数据: var resource = $resource('/data/getImage/:id', {id: '@id'}, {getImage: {method: 'GET', isArray: false}}); resource.get({id: _id}, function (image) { console.log('getImageById'); console.log(image); callback(image); }); 所以,我的问题是我怎么可以在图像标签中显示这个接收到的数据? 谢谢

Monit不发送警报消息,并给出错误“Alert handler failed,retry scheduled for next cycle”

我们使用监视器来监视服务器,如空间使用情况,CPU使用情况等。 当资源限制超过,monit不发送警报消息,并给出以下错误 – Sendmail错误:534-5.7.9请使用您的Web浏览器login,然后再试一次。 警报处理程序失败,重试计划下一个周期。