摘要: 1. 用var 创建的全局变量(这类变量在函数外部创建) 不能删除。2. 不能用Var 创建的隐含全局变量。(函数内部创建) 可以删除。 阅读全文
posted @ 2015-03-03 13:59 加油小猪2015 阅读(74) 评论(0) 推荐(0)
摘要: 1. back to top// Back To Top$('a.top').click(function(){$(document.body).animate({scrollTop : 0},800);return false;});//Create an anchor tagBack to to... 阅读全文
posted @ 2015-01-23 13:47 加油小猪2015 阅读(120) 评论(0) 推荐(0)
摘要: Services 的特性01. Service 都是单例的02. Service 由$injector 负责实例化03. Service 在整个生命周期都存在,可以用来共享数据。04. 在需要使用的地方利用依赖注入机制注入Service05. 自定义的Service 需要在内置的Service后面... 阅读全文
posted @ 2014-11-24 10:27 加油小猪2015 阅读(114) 评论(0) 推荐(0)
摘要: 首先看一个例子:var myModule = angular.module("myModule",[]);myModule.directive("hello",function(){ return{ restrict : "E", template:"Hi 111", replace:true }}... 阅读全文
posted @ 2014-11-20 09:13 加油小猪2015 阅读(97) 评论(0) 推荐(0)
摘要: 这个图是官方推荐的angular js 模块化的写法:var bookStoreApp = angular.module("bookStoreApp",['ngRoute','ngAnimate','bookStoreCtrls','bookStoreFilters','bookStoreServi... 阅读全文
posted @ 2014-11-17 15:58 加油小猪2015 阅读(297) 评论(0) 推荐(0)
摘要: Angularjs Controller 使用过程中的注意点:1.不要试图去复用 Controller, 一个控制器一般只负责一小块试图。2.不要在Controller 中操作DOM, 这不是控制器的职责。3.不要在Controller 里面数据格式化,ng 有很好用的表单空间4. 不要在Contr... 阅读全文
posted @ 2014-10-28 14:09 加油小猪2015 阅读(125) 评论(0) 推荐(0)
摘要: 基础ng 属性指令,例如: 01. ng-href02. ng-src03. ng-disabled04. ng-checked05. ng-readonly 06. ng-selected07. ng-class08. ng-style例子: enter这个例子当ng-model 没有text ... 阅读全文
posted @ 2014-09-24 13:30 加油小猪2015 阅读(144) 评论(0) 推荐(0)
摘要: 我们实现一个方法,这个公用的方法保存在控制器(controller)里面, 我们在指令(directive) 里面的mouseover() 方法里面调用loadMore() 方法。 示例:/--HTML code--/ Roll over to load more twitters /--ja... 阅读全文
posted @ 2014-09-23 16:11 加油小猪2015 阅读(212) 评论(0) 推荐(0)
摘要: 一,指令的创建/*--Js code--*/var app = angular.module("superhero",[]);app.directive("superman",function(){return { restrict: "E", template: " Here I am to... 阅读全文
posted @ 2014-09-23 13:03 加油小猪2015 阅读(287) 评论(0) 推荐(0)