
AngularJS
David_Hernandez
NLP
展开
-
Note01--核心特性
Source:《AngularJS实战》 1. MVC a. HelloAngular_MVC.html<!doctype html> <html ng-app> <head> <meta charset="utf-8"> </head> <body> <div ng-controller="HelloAngular原创 2017-01-23 17:29:57 · 555 阅读 · 0 评论 -
Note02--前端开发环境
1. 代码编辑工具 a. 轻量级:Sublime b. IDE:webstrom 2. 断点调试工具 a. chrome插件:Batarang 3. 版本管理工具 a. Git b. git小乌龟:tortoisegit 4. 开发和调试工具 a. NodeJS 5. 代码合并和混淆工具 a. Grunt: i. 当前目录:np原创 2017-01-23 18:37:53 · 367 阅读 · 0 评论 -
Note03--MVC && scope
为什么需要MVC? a. 代码规模越来越大,切分职责是大势所趋; b. 为了复用:很多逻辑都是一样的; c. 为了后期维护方便:修改一块功能不影响其他功能; d. MVC只是手段,终极目标是模块化和复用!!! AngularJS的MVC是借助于$scope实现的!!! Controller实现方式 a. 方式一无法适应大型应用 b. 方式二无法实现复用 c. 方式三原创 2017-01-23 18:45:03 · 303 阅读 · 0 评论 -
Note04--路由 && 模块 && 依赖注入
1. 一个项目的目录结构: 2. 模块化 a. 步骤: i. 在HTML标签上绑定ng-controller ii. 定义module,在module上绑定controller b. e.g. i. NgModule.html<!doctype html> <html ng-原创 2017-01-24 01:54:20 · 320 阅读 · 0 评论 -
Note05--双向数据绑定
1. 双向指的是:数据模型--》视图;视图--》数据模型; 2. 绑定的方式: a. Ng-bind 或者 双括号; i. 双括号方式,在网络不好的情况下,会出现双括号显示在页面中; ii. 使用ng-bind方式而不是{{ ** }}方式绑定值; b. 两者使用的原则: i. 在首页index.html中,使用ng-bind方式,之原创 2017-01-24 02:04:31 · 469 阅读 · 0 评论 -
Note06--路由
1. AJAX的缺点 2. AJAX的缺点是前端为什么需要路由的重要原因! 3. 深层次嵌套路由:页面的一部分内容变换 a. 使用angularJS本身的路由实现比较困难,GitHub搜索AngularUI;https://angular-ui.github.io b. UIRoute3.js var routerApp = angular.module('routerApp', [原创 2017-01-24 23:33:46 · 371 阅读 · 0 评论 -
Note07--指令
1. 目录结构: 2. Restrict:匹配模式 a. 四个选项:AEMC i. A:attribute ii. E:element iii. M:comment 1) 书写时,两端需要加空格; 2) e.g. <!-- directive:hello --> iv. C:c原创 2017-01-25 00:05:08 · 634 阅读 · 0 评论 -
Note08--Service && Provider
1. 目录 2. $http a. E.g. i. HTTPBasic.html <html ng-app="MyModule"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="framework/an原创 2017-01-25 00:11:10 · 346 阅读 · 0 评论 -
Note09--Filter
1. 目录结构 2. e.g. a. Filter.html <html ng-app="MyModule"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script src="framework/angular-1.3.0.14/angu原创 2017-01-25 00:13:32 · 341 阅读 · 0 评论