Pro AngularJS学习笔记(一)

AngularJS围绕MVC框架构建,重要特点:

  1. 可扩展性
  2. 稳定性:AngularJS易于调试和修复,意味着长周期开发的维护变得更容易;
  3. 可测试:AngularJS支持单元(Unit)和端到端(End to End)测试,意味着你可以比你的用户更先发现和修复瑕疵;
  4. 标准化:AngularJS基于浏览器内嵌技术构建;
AngularJS是由GOOGLE发起并维护的开源Javascript库。并已被用在一些大型,复杂的web app中。

准备知识:
     需要熟悉HTML和CSS。

安装Node.js
     通常用于客户端web app开发的许多开发工具是用Javascript编写的,一般都基于Node.js来运行。Node.js基于与google chrome浏览器相同的JavaScript引擎,不同的是它可以在浏览器之外运行。提供了javascript程序开发的一个通用框架。
    访问http://nodejs.org下载并安装相应平台的Node.js包(支持windows,Linux,Mac OS),确保安装了Package Manager(包管理器),并将安装目录添加到环境路径。
    要测试Node.js是否已成功安装,只需打开命令行工具,并输入node.回车执行,然后输入如下代码:
   
function testNode() {return "Node已正常运行"}; testNode();
不出意外的话,将出现如下输出:
Node已正常运行

安装web服务器
简单的WEB服务器就可以满足运行条件,这里我安装了node.js内置的模块Connect。在node.js的安装目录下运行如下代码:
npm install connect

NPM是Node包安装器,它会自动下载connect所需的文件,并创建一个名为connect的目录。
下面,我们创建一个新的文件,取名为server.js(仍旧放在node.js的安装目录下),输入如下内容:
var connect = require('connect');
connect.createServer(
connect.static("../angularjs")
).listen(5000);

这个文件创建了一个简单的WEB服务器,用于响应来自端口号5000的请求,并将请求与目录下的angularjs目录进行关联——同样它也将建在node.js的安装目录之下。

安装测试系统:
这里使用了Karma test runner和Jasmine test framework,与前面相同,在命令行切换至nodejs安装目录并运行如下命令:

创建AngularJS目录,前面我们写的server.js中引用了一个名为angularJS的目录,而这个目录在nodejs目录下是不存在的,我们需要手工创建它。当然你也可以将其创建在其它位置,但不要忘记更改server.js中的设置。

下载AngularJS
    由于angularjs官网使用了google的CDN加速,导致国内访问有点问题,所以请从以下地址下载相应的版本:https://code.angularjs.org/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
AngularJS is the leading framework for building dynamic JavaScript applications that take advantage of the capabilities of modern browsers and devices. AngularJS, which is maintained by Google, brings the power of the Model-View-Controller (MVC) pattern to the client, providing the foundation for complex and rich web apps. It allows you to build applications that are smaller, faster, and with a lighter resource footprint than ever before. Best-selling author Adam Freeman explains how to get the most from AngularJS. He begins by describing the MVC pattern and the many benefits that can be gained from separating your logic and presentation code. He then shows how you can use AngularJS's features within in your projects to produce professional-quality results. Starting from the nuts-and-bolts and building up to the most advanced and sophisticated features AngularJS is carefully unwrapped, going in-depth to give you the knowledge you need. Each topic is covered clearly and concisely and is packed with the details you need to learn to be truly effective. The most important features are given a no-nonsense in-depth treatment and chapters include common problems and details of how to avoid them. What you'll learn •Gain a solid architectural understanding of the MVC Pattern to separate logic, data and presentation code. •Learn how to create rich and dynamic web apps using AngularJS •Understand how each feature works and why it is important •Understand how to extend HTML with declarative syntax •Learn how to extend and customize AngularJS •Learn how to test, refine, and deploy your AngularJS projects Who this book is for This book is ideal for web developers who have a working knowledge of JavaScript, HTML and CSS. The book is platform agnostic and a range of browsers will be presented and discussed throughout the examples.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值