AngularJS tips
Blogs20142014-11-27
AngularJS tips
Watch the youtube vedio: AngularJS Top 10 Tips, here is the summary for quick retrieving:
ng-cloak
The ngCloak directive is used to prevent the Angular html template from being briefly displayed by the browser in its raw (uncompiled) form while your application is loading. Don’t show {{}} before loading page. Alternative:
- ng-bind/ng-src
- resolve
ui-router/ngRoute
Normally we put all routes into 1 app.js file; however, we can separate `$stateProvider`/`$routeProvider` into several files’ config(), based on different modules.
ng-annotate
ng-annotate adds and removes AngularJS dependency injection annotations. Annotations are useful because with them you’re able to minify your source code using your favorite JS minifier. See more: https://github.com/olov/ng-annotate
- ngmin/ugify
- html2js
- concat,uglify,recess,etc
- Batarang
generatedata.com
A good place to generate RESTFUL API JSON Data, can work with Angular $resource in an Agile Development env.
Memory leaks
$scope.$on(‘$destroy’, …);
