Monday, December 15, 2014

several points on Angular JS usage

Just things in random order, I've came across last days.

1) Scroll other div to specific place  -
( by default there is a service that working for window element)

2) Syntax with binding once of model properties in templates like {{::myStaticVar}} - does not work by some reason, gives parse error. (Maybe it was removed in one of the versions ??)

3) Working with events: $scope.$broadcast -> goes DOWN, while $scope.$emit -> goes UP in scopes

4) Watch tools, basic - $scope.$watch(‘varName’, callback)
 - also available watchCollection for array of vars (
 - if you want to access $parent or $root scope, you can use first argument as a function that will return needed scope value (
 - if you need the directive to update dynamically on scope changes - use scope.$watch subscription on vars changes in its link function

6) several dozens of other tips and tricks using Angular JS -