自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Beyond The Sky

Just Fly !

  • 博客(26)
  • 资源 (2)
  • 收藏
  • 关注

原创 angular $http 官方实例说明

General usageThe $http service is a function which takes a single argument — a configuration object — that is used to generate an HTTP request and returns a promise.// Simple GET request exa

2016-06-28 18:01:29 646

原创 angular $q 官方实例代码

// for the purpose of this example let's assume that variables `$q` and `okToGreet`// are available in the current lexical scope (they could have been injected or passed in).function asyncGreet(nam

2016-06-28 17:46:36 835

转载 $q -- AngularJS中的服务

原文链接: $q 官方文档描述既然是用来处理异步编程的,那么在浏览器端的JS里,主要是2种: setTimeout 和 Ajax 请求.  promise 的使用就很像Ajax请求的成功和失败回调。此承诺/延迟(promise/deferred)实现的灵感来自于  Kris Kowal's Q CommonJS Promise建议文档 将承诺(promise)

2016-06-28 17:17:26 564

转载 找出丢失的数字

找出丢失的数字标签: 算法扩展面试存储2011-11-04 07:02 1232人阅读 评论(0) 收藏 举报 分类: 算法 (Algorithm)(111) 有一组数字,从1到n中减少了一个数,顺序也被打乱了,放在一个n-1的数组里,请找出丢失的数字。1、用1+2+...+n(即n(n+1)/2)减去当前输入数据的总和。

2016-06-28 09:25:08 883

原创 angular 插件angular-hint

angular-hint可以帮助我们写出更好的angular代码,以及更容易定位angular中常见的错误。使用方式:1、使用chrome的插件 batarang2、手动集成angular-hint,通过 npm install angular-hint --save启用ngHint指令:  /启用全部module显示制定需要的module: 

2016-06-27 11:37:24 408

转载 Object.observe() js新特性

Object.observe() 用来实时监测js中对象的变化,变化时调用一个方法。使用此方法,可以代替angular中的脏检查,可以大大的提高性能,详情可以看下文。【翻译】Object.observe()带来的数据绑定变革时间 2014-05-27 09:44:54  云和移动的彼端原文  http://mweb.baidu.com/p/object-obse

2016-06-27 10:56:40 18388 2

原创 数组与字符串的相互转化 Js

数组与字符串的相互转化var obj="new1abcdefg".replace(/(.)(?=[^$])/g,"$1,").split(",");       //字符串转化为数组var obj2 = "new2abcdefg".split("");                                            //字符串转化为数组alert(obj)

2016-06-17 16:28:13 405

转载 Javascript 中 atob 方法解码中文字符乱码问题

解决 Javascript 中 atob 方法解码中文字符乱码问题由于一些网络通讯协议的限制,你必须使用 window.btoa() 方法对原数据进行编码后,才能进行发送。接收方使用相当于 window.atob() 的方法对接受到的 base64 数据进行解码,得到原数据。例如,发送某些含有 ASCII 码表中 0 到 31 之间的控制字符的数据。window.bto

2016-06-17 16:27:30 7079

原创 angularJs三种依赖注入方式与minify

依赖注入(饭来伸手,一来张口)DI,Dependency InjectioAngularJs使用module“名字/对象”注册表来作为容器,实现DI。依赖注解有三种方式,(数组标注、添加$inject属性、隐式声明)。其中前两种在代码minify时不会被破坏,推荐使用第一种方式。第二种方式可以自己手动改写(下面有例子),也可以使用工具ngAnnotate对隐式声明进

2016-06-15 15:58:35 2649

原创 获取中国 省市区 js

三个方法用于获取中国的省份、市、县区。从网上找到了中国省市区的json串,然后用js写了一个utl工具,分享给大家。ChinaCity.getProvince = getProvince;ChinaCity.getCity = getCity;ChinaCity.getArea = getArea;(function(){ //收录了中国的省市区县数据 var c

2016-06-15 12:03:48 13070 1

原创 银行卡号- 查询银行卡信息

工作中用到的一个功能,下面是用js实现的一个util。花了不少的时间折腾这个,把结果分享给大家。(function() { //cardType:DC->储蓄卡,CC->信用卡 //var root = global; var cardTypeMap = { DC: "储蓄卡", CC: "信用卡", SCC: "

2016-06-15 11:53:50 22070 2

原创 JavaScript toLocaleString()

JavaScript toLocaleString() 函数详解toLocaleString()函数用于将当前对象以字符串值的形式返回,该字符串的格式适合当前宿主环境的当前区域设置。该方法属于Object对象,由于所有的对象都"继承"了Object的对象实例,因此几乎所有的实例对象都可以使用该方法。所有主流浏览器均支持该函数。语法object.toLoc

2016-06-13 16:06:23 878

原创 valueOf 和 toSring

toString()函数用于将当前对象以字符串的形式返回。该方法属于Object对象,由于所有的对象都"继承"了Object的对象实例,因此几乎所有的实例对象都可以使用该方法。所有主流浏览器均支持该函数。valueOf()函数用于返回指定对象的原始值。该方法属于Object对象,由于所有的对象都"继承"了Object的对象实例,因此几乎所有的实例对象都可以使

2016-06-13 16:03:36 754

原创 Object.entries()

This is an experimental technologyBecause this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of

2016-06-13 15:52:31 946

原创 Object.values() (非标准)

This is an experimental technologyBecause this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of

2016-06-13 15:51:56 2818

原创 Object.keys()

The Object.keys() method returns an array of a given object's own enumerable properties, in the same order as that provided by a for...in loop (the difference being that a for-in loop enumerates p

2016-06-13 15:51:09 1712

原创 Object.getOwnPropertyNames()

The Object.getOwnPropertyNames() method returns an array of all properties (enumerable or not) found directly upon a given object.SyntaxObject.getOwnPropertyNames(obj)ParametersobjThe

2016-06-13 15:44:59 1620

原创 The in operator

The in operator returns true if the specified property is in the specified object.Syntaxprop in objectNameParameterspropA string or symbol representing a property name or array index (

2016-06-13 15:40:04 304

原创 instanceof

The instanceof operator tests whether an object has in its prototype chain the prototype property of a constructor.Syntaxobject instanceof constructorParametersobjectThe object to test

2016-06-13 15:38:05 518

原创 isPrototypeOf()

The isPrototypeOf() method tests for an object in another object's prototype chain.Note: isPrototypeOf differs from the instanceof operator. In the expression "object instanceof AFunction"

2016-06-13 15:34:56 491

原创 hasOwnProperty()

The hasOwnProperty() method returns a boolean indicating whether the object has the specified property.Syntaxobj.hasOwnProperty(prop)ParameterspropThe name of the property to test.

2016-06-13 15:21:16 1090

转载 Js作用域链

一:函数作用域   先看一小段代码:[javascript] view plain copyvar scope="global";  function t(){      console.log(scope);      var scope="local"      console.log(scope);  }  t(

2016-06-07 16:22:19 278

转载 angularjs 表单验证

表单验证常用的表单验证指令 1. 必填项验证某个表单输入是否已填写,只要在输入字段元素上添加HTML5标记required即可:  2. 最小长度验证表单输入的文本长度是否大于某个最小值,在输入字段上使用指令ng-minleng= "{number}": 3. 最大长度验证表单输入的文本长度是否小于或等于某个最大值,在

2016-06-07 16:18:15 479

转载 HTTP 状态代码

所有 HTTP 状态代码及其定义。  代码  指示  2xx  成功  200  正常;请求已完成。  201  正常;紧接 POST 命令。  202  正常;已接受用于处理,但处理尚未完成。  203  正常;部分信息 — 返回的信息只是一部分。  204  正常;无响应 — 已接收请求,但不存在要回送的信息。  3xx  重定向  301  已移动 —

2016-06-06 16:37:11 1054

转载 js中bind、call、apply函数的用法

为了介绍 bind、call、apply 这三个函数的用法,不得不介绍 js 里函数的一些设定。关于这部分推荐通读 《javascript编程精粹》 的第四章,这里我所说的在书里都能找到。关于这三个函数的详细介绍,可以参看 MDN 的文档:bind、call、apply。下面开始搬砖,修改自我之前在 segmentfault 上的答案:js 里函数调用有 4 种

2016-06-02 10:02:52 466

转载 关于 ng-repeat

AngularJs 的 ng-repeat 让我们非常方便的遍历数组生成 Dom 元素,但是使用不当也会有性能问题。在项目中我们使用 ng-repeat 加载完一个列表后,如果再次请求数据,然后过滤列表,代码可能会这么写:div ng-controller="Test"> button ng-click="request()">请求新数据button> div ng-rep

2016-06-01 15:50:38 958

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除