- Angular-seed repo
- Yeoman angular (strongly advised). Provides commands to generate: directives, controllers, views
Use ng-cloak
directive to hide interpolation tags {{}}
in index.html
Ex: <body ng-cloack>
And use ng-bind
instead of interpolation to avoid showing {{}}
. Ex: <span ng-bind="ctrl.value">?</span>
#Use minification? Maybe not... many times this is not necessary
The use of prefixes might not work in IE. Use instead <div app-blinkdirective>
Put DOM manipulation in directives
Don't put DOM in the controllers
No DOM
Singletons
Independent of view
Use for cache. Services exist for the hole lifecycle of the application
READ ONLY in templates
WRITE ONLY in controllers
scope is not the model
ng-model if don't have a dot, you are doint it wrong
angular.extend(obj1, obj2)
to extend objects
angular.isObject()
to check if a variable is an object
angular.isArray()
to check if a variable is an array
angular.forEach(data, function (value, key) { ... })
enumerating an object's properties
"property1" in myData
Check if object has a property
angular.module(moduleName).constant(name, value)
Creates a new constant in a module