angular/angular.js — pull request #6420 by sgrif (2014-02-23 22:58:30+00:00)
Title: feat($parse): Getter/Setter functions as assignable expressions

Allow a getter/setter function to be treated as an assignable expression
by calling the function with `$value` in its argument list. It is
assumed that functions called this way will follow the convention used
by angular in its providers, where calling the function with no
arguments acts as a getter, and calling it with arguments acts as a
setter.

In addition to `$parse`, the modules most affected by this change are
`ngModel`, and `$compile` (when adding a bi-directional binding to the
scope by using `'='`). Tests and documentation are included for those modules,
in addition to `$parse`, with a full usage example in `ngModel.NgModelController`.

The overall goal is to better allow support for "computed" properties,
and allow easier delegation between modules, without consuming code
having to change or break encapsulation to bind to these values.

An alternative API would be to have this behavior happen automatically if
the bound expression evaluates to a function, which would allow
consuming code to simply write ``, and not have
to care about whether name is a property or a getter/setter function.
While this would better follow the uniform access principle, it would
introduce a fair amount of magic, and could lead to unexpected behavior
with bi-directional bindings on directives.