Angularjshtml
表单验证:https://www.w3xue.com/jsjq/angularjs/angularjs-validation.htmljava
http://www.javashuo.com/article/p-usfzvhfm-e.htmlgit
表单验证后回调:http://www.javashuo.com/article/p-nvnrfycx-hn.htmlangularjs
factory vs service vs provider:https://www.oschina.net/translate/angularjs-factory-vs-service-vs-providergithub
select控件:https://m.runoob.com/angularjs/angularjs-select.htmlsegmentfault
$q和promise:http://www.javashuo.com/article/p-baoeuhnz-q.htmlpromise
本身理解:app
一、何时须要用promise?ide
当服务提供方想要本身提供的服务在执行成功后/失败后/值变化之后触发服务调用方相应的回调函数时,使用之。函数
二、使用方法
由服务提供方在服务方法的逻辑中使用$q.deffer()建立一个deffer对象。在服务逻辑执行成功/失败/关键值改变之后分别调用deffer的resolve(value)/reject(data)/notify(data)方法,并在服务逻辑的最后使用deffer.promise()方法返回promise对象。服务调用方调用了服务方法之后直接.then(),then方法里能够传三个回调函数,这三个回调函数分别在deffer的resolve(value)/reject(data)/notify(data)方法执行后自动被调用。第二个回调函数也会在resolve执行失败之后调用。
三、补充
3.1 deffer的三个方法能够单独使用,then方法也不必定必须传三个回调函数,也能够传一个或者两个回调函数,then方法返回promise对象,因此能够连续.then()。
3.2 promise还有两个方法catch()和finally()。
3.3 deffer的所谓关键值改变notify方法其实就是方便开发人员灵活应用的一种回调场景。只要你打算在编写的服务代码的某处触发调用者的回调函数,就使用notify,固然,其实resolve和reject也是能够灵活使用。
四、deffer只是$q的一种功用。
Angularjs里的定时器和循环执行:
http://www.javashuo.com/article/p-bxkkrstt-bx.html
定时器的销毁:http://www.javashuo.com/article/p-zmfrfcxg-gd.html
如何在主页面和ngdialog之间传递参数?
https://segmentfault.com/q/1010000007149580
一、必须作的步骤:ngDialog的scope:$scope
二、如何向主页面的$scope赋值:在ngDialog的controller中,使用$scope.$parent即等价于主页面中的$scope
三、如何从主页面的$scope中取值?直接使用主页面中$scope的变量便可。
参考资料:https://github.com/likeastore/ngDialog
使用$watch监听对象的改变:
http://www.zymseo.com/386.html
https://www.cnblogs.com/yg_zhang/p/4799369.html
$scope.$watch('targetObj', function(n, o){
XXXXXX
}, true);
n表明新值,o表明老值,若是被监听的是一个对象,则第三个参数必须带,且是true。
id问题:
$apply的使用:
$http在post时,参数params和data有何区别?以及其余参数的学习: