Saturday, January 4, 2014

AngularJS directives and filters

This week I was taught: In the strictest since, directives and filters only really differ from services in that they use their own pools in lieu of using the global provider pool (which services uses). Directives by convention are for macros (what might be widgets in Dojo) and filters are for transforming values. They are typically used in a nameOfVariableForUnalteredValue|nameOfFilterVariable manner in which the whole of the pipe symbol divided item behaves as a variable for the filtered string. Directives have their own scope and one pushes back out to outer scope by using $scope.$parent.$digest(); There are different ways to map outer scopes to directive-specific scopes via = and @ and other operatives. The = makes a one-to-one relationship. Two way binding is the update-in-one-place/update-in-both-places associations between scope and a chunk of UI.

No comments:

Post a Comment