- 博客(15)
- 收藏
- 关注
原创 Javascript的奇怪用法
在看AngularJS源码时看到一些Javascript的奇怪写法,先记录下来。1.(function(){ window.work=function(){}....})(window)此法一般在写插件时用,以前在JQuery插件中也见过,意思是声明一个方法,并立即执行它,同时还传入参数window,与下面代码的意思是一样的:function Controller(w){
2014-12-11 08:29:45
333
原创 AngularJS(Part 10)
页面导航 过去,一个URL代表一个页面。但是随着Ajax的兴起,情况发生的很大的变化。不同的内容可以使用同一个URL。这让浏览器中的回退、前进甚至收藏按钮都失去了作用。而AngularJS提供了一套解决方案能够避免这种情况。 怎么解决,有一个小技巧:浏览器不会因为URL中#符号后面的值改变而重新请求页面。(关于#符号,参见另一博文) 现有如下RESTful的的UR
2014-12-10 08:26:12
247
转载 URL中#符号的作用
转自http://blog.sina.com.cn/s/blog_6f9eb2dd0100sk97.html一、#的涵义 #代表网页中的一个位置。其右面的字符,就是该位置的标识符。比如, http://www.example.com/index.html#print 就代表网页index.html的print位置。浏览器读取这个URL后,会自动将pr
2014-12-10 08:19:03
402
转载 死理性派
青年问禅师:“大师,我很爱我的女朋友,她也有很多优点,但是总有几个缺点让我非常讨厌,有什么什么方法能让她改变?”禅师浅笑,答:“方法很简单,不过若想我教你,你需先下山为我找一张只有正面没有背面的纸回来。”青年略一沉吟,默默地掏出一个麦比乌斯环。青年问禅师:“我的心被忧愁和烦恼塞满了怎么办?”禅师若有所思地说:“你随手画一条曲线。用放大镜放大了看。它的周围难道不是十分明朗开阔吗?
2014-12-08 19:28:52
367
原创 AngularJs(Part 9)
AngularJS 表单 AngularJS使用了MVX的结构,我们可以是传统的表单更加强大。比如过去我们得自己写一大堆验证,比过过去我们得自己转换用户的输入,现在这些工作全部可以交给AngularJS. 我们唯一要关心的就是model中的值。在AngularJS中 ,form和input其实也是directive。(是不是很奇怪!) 这两个家伙就是传统form的加强版。
2014-12-08 19:08:44
253
原创 AngularJs(Part 8)
FiltersAngularJS provides fileters to transfrom data from one kind to another . For example: {{user.birthday | date:'yyyy-MM-dd'}}In this example, the date filter is used to format user's bir
2014-12-05 10:10:43
251
原创 AngularJs(Part 7)
DirectivesIn AngularJS, we can use a variety of naming conventions to reference directives .In the AngularJS documentation, all the directive are indexed under their camel-case name(For example,
2014-12-05 10:09:54
272
原创 AngularJs(Part 6)
Overcomming same-origin policy restrictions with JSONP.AJAX has a restriction that it can only retrieve data from the same resource.There are several techniques for accessing dta exposed by extern
2014-12-05 10:08:27
214
原创 AngularJs(Part 5)
Communicating with a Back-end Server.for AngularJs, there is a general purpossst $http service for issuing XHR and JSONP callsas well as a specialized $resource service to targe RESTful endpoint
2014-12-05 10:07:26
261
原创 Promise API
Promise API刚刚接触promise这个东西,网上看了很多博客,也不是太明白。恼火了,决定自己先实现个和promise相同的API,然后再看promise的具体介绍并深入学习。 我觉得别人再怎么聪明,也不可能跳出Javascript的框架,我的实现怎么的都可以为我学习Promise提供一定的基础。首先,我大体看过别人的实现,觉得他类似Java中的观察者模式。先注册观察者
2014-11-17 17:37:31
616
原创 AngularJs(Part 4)
Modules depending on other ModulesAngular does an excellent job of managing object dependencies. it can even take care of module dependencies.So we can easily group releated services into one modu
2014-11-16 17:54:11
220
原创 AngularJs(Part 3)
Modulesthe "founding father" of angular think the global-defined controller is ugly.so they provide some APIs in Angular to declare those controllers.angular.module('hello',[]).controller(
2014-11-16 17:53:58
241
原创 AngularJs(Part 2)
Viewafter a browser is done transforming the arkup's text to the DOM tree.the AngularJs kicks in and traverses the parsed DOM structure.each time it encounters a directive, AngularJs executes
2014-11-16 17:51:22
267
原创 AngularJs(Part 1)
I am Scopea new scope is created by the ng-controller directive using the Scope.$new() method call.yes , we need to have at least one instance of a scope beforecreating a new scope!s
2014-11-16 17:49:13
221
原创 关于REST的一些想法
REST and RESTful最近入手了REST,谈谈自己的体会。所谓REST, 我觉得是一种网址的设计风格。过去我们用Struts 或Spring MVC 时从来没有考虑过URL的设计风格。所有的URL大体都是 XXX/?name=Mike&age=12 这种样式的,并且时间长了都觉得这是理所当然的。要不然你说网址要设计成什么样?好吧,如果我没记错的话,在Java Se
2014-11-14 09:14:41
336
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人