HaoJu Zheng
HaoJu Zheng
关于package.json 和 bower.json中 包的版本中~和^的含义。 http://stackoverflow.com/questions/22343224/difference-between-tilde-and-caret-in-package-json ``` ~version Approximately equivalent to version ^version Compatible with version version Must match version exactly >version Must be greater than version >=version
CSS3 一个动画的 [Example](http://codepen.io/bvbrandon/pen/Hvqes?utm_source=CSS-Weekly&utm_campaign=Issue-130&utm_medium=web)
2015年 第一篇,祝福CUF Team越来越强!
#### gulp常用插件 [event-stream](http://www.atticuswhite.com/blog/merging-gulpjs-streams/) 事件流,不是插件但很有用 [gulp-clean](https://github.com/peter-vilja/gulp-clean) 删除文件和目录 [gulp-concat](https://github.com/wearefractal/gulp-concat) 合并文件 [gulp-if](https://github.com/robrich/gulp-if) 有条件的运行一个task [gulp-minify-css](https://github.com/murphydanger/gulp-minify-css)压缩css [gulp-ng-annotate](https://github.com/Kagami/gulp-ng-annotate) 注明依赖 for angular [gulp-ng-html2js](https://github.com/marklagendijk/gulp-ng-html2js) html2js for angular [gulp-uglify](https://github.com/terinjokes/gulp-uglify) 用uglify压缩js [gulp-load-plugins](https://github.com/jackfranklin/gulp-load-plugins) 自动导入gulp plugin [gulp-load-utils](https://www.npmjs.com/package/gulp-load-utils) 增强版gulp-utils [gulp-angular-extender](https://libraries.io/npm/gulp-angular-extender) 为angular module添加dependencies [gulp-usemin](https://github.com/zont/gulp-usemin)...
#### 一周前端好文分享 JavaScript Bad Parts (翻墙) http://johnkpaul.github.io/presentations/empirejs/javascript-bad-parts decimal.js 处理某些JS数学运算的精度问题 https://github.com/MikeMcl/decimal.js?utm_source=javascriptweekly&utm_medium=email Overview of ECMAScript 6 features https://github.com/lukehoban/es6features#template-strings Chrome support ES6 template string (翻墙) https://twitter.com/addyosmani/status/541978036904554496?utm_source=javascriptweekly&utm_medium=email  Five Traits of Well-Managed JavaScript http://www.ifwe.co/blog/posts/five-traits-of-well-managed-javascript/?utm_source=javascriptweekly&utm_medium=email...
#### $compile > Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together. 下面Code中使用了$compile方法...
#### $templateRequest `$templateRequest(tpl, [ignoreRequestError]);` > `$templateRequest` service 使用`$http` service将所需要的html模板下载下来 并存到 `$templateCache` 中. 如果 HTTP 请求失败 或者 返回的数据为空, 一个 `$compile` 异常将会被抛出 (这个异常可以通过设置第二参数为true,阻止掉). 如何使用 ``` javascript angular.module("app", []).run(function($templateRequest) { $templateRequest("/templates/editor.html"); }); ```
#### $templateCache 这个service就不多说了,大家可以自己参考文档,`$templateRequest` 将模板存入它里面。我只需要通过`$templateCache` 的get方法取出来就行。 #### directive definition object (参考官方文档) ``` var myModule = angular.module(...); myModule.directive('directiveName', function factory(injectables) { var directiveDefinitionObject = { priority: 0, template: '', // or //...
#### require other directives 在directive definition object 中配置require,可以使一个指令,也可以是一个指令数组 `require: '^foo'` 或这 `require:['^foo', 'bar']`, 这样就可以在link方法中使用你require的指令的controller方法中的方法了,当然有时候,你需要自己引入自己,可以参照 https://github.com/angular-ui/bootstrap/blob/master/src/buttons/buttons.js 非常有意思。 注意这些语法: > (no prefix) - Locate the required controller on the current element. Throw...
#### directive communication ($scope.$broadcast, $scope.$on) 指令之间的沟通,数据传递和交换,可以通过$broadcast 和 $emit 方法传递事件的方式进行沟通 $broadcast 向 scope children 传递 $emit 向 scope parents 传递 大家可以参考,本视频的例子 https://github.com/davemo/advanced-directives-with-angular-js/blob/master/grid_directives.js