Node.js、Ionic、Cordova、AngualrJS 安装指南
1.
目录
一.Node.js ...................................................................................................................................... 3
1. Node.js .................................................................................................................................. 3
1.1 Node.js 简介 ............................................................................................................... 3
1.2 Windows 下安装 Node.js ........................................................................................... 4
2. NPM....................................................................................................................................... 4
2.1 npm 简介 ................................................................................................................... 4
2.2 安装 npm ................................................................................................................... 4
3. Express .................................................................................................................................. 4
3.1 Express 简介 ............................................................................................................... 4
3.2 安装 express ............................................................................................................. 5
4. 检验是否安装成功 .............................................................................................................. 5
5. 创建 hellworld 工程 ............................................................................................................ 5
6. 用 npm 进行添加和启动项目 ............................................................................................ 6
7. 访问...................................................................................................................................... 7
二.Ionic ........................................................................................................................................... 8
Ionic ................................................................................................................................... 8
1.1 Ionic 简介 ................................................................................................................... 8
1.2 安装 Ionic ................................................................................................................... 8
1.2 开始一个 Ionic APP ................................................................................................... 9
1.3 如何使用模板 ............................................................................................................. 9
1.4 在浏览器中测试 ........................................................................................................ 9
15 添加平台 .................................................................................................................... 10
2. ANT .................................................................................................................................. 10
2.1 ANT 简介 ................................................................................................................... 10
2.2 安装 ant ................................................................................................................... 10
3. build 项目............................................................................................................................ 11
4 配置 android AVD ............................................................................................................... 12
5 安装 APP 到模拟器 ............................................................................................................ 13
6 安装 APP 到手机 ................................................................................................................ 14
三.Cordova ................................................................................................................................... 16
1. Android SDK .................................................................................................................... 16
1.1 简介........................................................................................................................... 16
1.2 安装 Android SDK ..................................................................................................... 16
2. ADT .................................................................................................................................. 17
2.1 ADT 简介 ................................................................................................................... 17
2.2 安装 ADT ................................................................................................................... 18
3. GIT ................................................................................................................................... 18
3.1 GIT 简介 .................................................................................................................... 18
3.2 特点........................................................................................................................... 18
3.3 安装 GIT .................................................................................................................... 20
4. Cordova ............................................................................................................................... 20
4.1 Cordova 简介 ............................................................................................................ 20
4.2 安装 Cordova ........................................................................................................... 20
5. Bower .................................................................................................................................. 21
5.1 Bower 简介 ............................................................................................................... 21
5.2 安装 bower .............................................................................................................. 21
6. 创建 APP ............................................................................................................................ 22
7. 添加平台支持 ................................................................................................................... 23
8. Build APP ........................................................................................................................... 24
9. 准备和编译 APP ............................................................................................................... 24
10. 安装 APP 到模拟器 ......................................................................................................... 24
11. 安装 APP 到手机 ............................................................................................................. 25
12. 添加插件功能 .................................................................................................................. 26
13.查看已安装插件 ................................................................................................................ 28
14.移除插件............................................................................................................................ 28
15.高级插件选项 .................................................................................................................... 29
四.Bootstrap ................................................................................................................................. 29
1. Bootstrap 简介 .................................................................................................................... 29
1.1 Bootstrap 特点 .......................................................................................................... 29
1.2 Bootstrap 组件 ......................................................................................................... 30
1.3 Javascript 插件 ......................................................................................................... 30
2.安装 Bootstrap ..................................................................................................................... 30
2.1 通过 bower 安装 ..................................................................................................... 30
2.2 通过 npm 进行安装 ................................................................................................ 30
3. 目录结构 ............................................................................................................................ 31
3.1 预编译版 .................................................................................................................. 31
3.2 Bootstrap 源码 ......................................................................................................... 32
4. GRUNT ................................................................................................................................. 32
4.1 Grunt 简介 ................................................................................................................ 32
4.2 Grunt 安装 ................................................................................................................ 32
4.3 可用的 Grunt 命令 ................................................................................................. 33
五.AngularJS ................................................................................................................................. 34
1. AngualrJS 简介 ................................................................................................................ 34
2. AngularJS 特性 ................................................................................................................ 34
2.1 特性一:数据绑定 ................................................................................................... 34
2.2 特性二:模板 ........................................................................................................... 34
2.3 特性三:MVC ........................................................................................................... 35
2.4 特性四:依赖注入(Dependency Injection,即 DI) ........................................... 35
2.5 特性五:Directives(指令) ................................................................................... 35
日期
2015-01-29
2015-02-03
版本
1.0
1.1
说明
初稿
修订
作者
李金柱
李金柱
一.Node.js
1. Node.js
1.1 Node.js 简介
Node.js® is a platform built on Chrome's JavaScript runtime for easily building fast, scalable
network applications. Node.js uses an event-driven, non-blocking I/O model that makes it
lightweight and efficient, perfect for data-intensive real-time applications that run across
distributed devices.
Node.js 是一个基于 Chrome JavaScript 运行时建立的一个平台, 用来方便地搭建快速的 易
于扩展的网络应用· Node.js 借助事件驱动, 非阻塞 I/O 模型变得轻量和高效, 非常适合
运行在分布式设备 的 数据密集型 的实时应用
1.2 Windows 下安装 Node.js
下载地址:http://nodejs.org/download/
根据您的操作系统选择相应的 32-bit 或者 64-bit 的.msi 或者.exe 文件并下载
以下两种方式任选其一:
1.
2. 在 E 盘创建文件夹 nodejs,拷贝 node.exe 到 nodejs 文件夹下,并将"E:\nodejs"加入系统
.msi 文件下载成功后双击选择“Next”完成安装
环境变量 PATH 中
2. NPM
2.1 npm 简介
A package manager for node
NPM 的全称是 Node Package Manager ,是一个 NodeJS 包管理和分发工具,已经成为了非官
方的发布 Node 模块(包)的标准。
Nodejs 自身提供了基本的模块,但是开发实际应用过程中仅仅依靠这些基本模块则还需要
较多的工作。幸运的是,Nodejs 库和框架为我们提供了帮助, 让我们减少工作量。但是成
百上千的库或者框架管理起来又很麻烦,有了 NPM,可以很快的找到特定服务要使用的包,
进行下载、安装以及管理已经安装的包
2.2 安装 npm
下载地址:https://github.com/npm/npm/tags
将 npm 源代码解压到 E:\npmjs 目录中。
在命令提示符窗口中执行下面的操作,完成 npm 的安装:
E:\>cd npmjs
E:\npmjs>node cli.js install npm –gf
NPM 安装完成后,将"E:\nodejs\node_modules"加入系统环境变量 NODE_PATH 中
3. Express
3.1 Express 简介
Express is a minimal and flexible Node.js web application framework that provides a robust set of
features for web and mobile applications.
Express 是一个极简的,灵活的 Node.js web 应用程序框架,针对 web 和移动应用程序提供
了一套强健的功能。
3.2 安装 express
在命令提示符窗口中执行下面的操作:
npm install express -g
npm install express-generator –g
安装成功后,目录如下:
4. 检验是否安装成功
在命令提示符窗口中执行下面的操作:
注:express –V,V 需要大写
5. 创建 hellworld 工程
在命令提示符窗口中执行下面的操作:
Express helloworld
工程目录创建成功:
6. 用 npm 进行添加和启动项目
在命令提示符窗口中执行下面的操作:
cd helloworld
npm install //下载依赖包
npm start //启动项目
目录介绍:
node_modules, 存放所有的项目依赖库。(每个项目管理自己的依赖)
package.json,项目依赖配置及开发者信息
app.js,程序启动文件
public,静态文件(css,js,img)
routes,路由文件(MVC 中的 C,controller)
Views,页面文件(Ejs 模板)
7. 访问
二.Ionic
1. Ionic
1.1 Ionic 简介
The beautiful, open source front-end SDK for developing hybrid mobile apps with HTML5.
Ionic offers a library of mobile-optimized HTML, CSS and JS components for building highly
interactive apps. It is built with Sass and optimized for AngularJS. It’s inand it looks like a very
promising framework for developing hybrid mobile apps in HTML5.
漂亮的,开源的前端 SDK,使用 HTML5 开发 hybrid 手机应用
Ionic 是一个用 HTML, CSS 跟 JS 开发的一个用于移动设备的混合 APP 开发框架,采用 Sass
与 AngularJS 开发
1.2 安装 Ionic
在命令提示符窗口中执行下面的操作:
$ npm install –g ionic
安装成功后: