>> To answer your question - the basic idea is that templates (maybe
>> excluding trivial ones) are not supposed to contain logic, it should
>> be coded in controllers and referenced by templates.
>
> The example I gave was a trivial one. Moving variables such as 'collapsed',
> 'expanded', 'visible' to the JavaScript side would pollute your controller
> logic, which (IMO) should have to deal only with the actual model as far as
> it relates to the application (ideally). These variables, though technically
> part of Angular's 'model', represent purely indicators of the current view
> (for instance, is something shown/hidden, collapsed/expanded). For
> instance, in a traditional web application, they might be ephemeral state
> and you normally wouldn't store them on the server.
As you said, your example was trivial, there was no need to put such a
simple logic inside controller. Sometimes presentation logic can
become more and more complicated and one day it makes everything
easier to move that logic to controller.
> The inheritance isn't causing the issue. It's the fact that assignments in
> the child scope do not propagate to the parent that can cause problems if
> the creation of a new scope is not apparent.
In your very case the inheritance was actually causing an issue. In
child scopes you were re-assigning values. This is how inheritance in
JavaScript works, it is not AngularJS invention. That is, however, not
a big deal, because - as Renan said, you can easily immune to such a
problems by introducing an intermediate object. In his version of your
jsfiddle the object was called "data", so you never reassign anything
on scope but on "data" instead. Scope inheritance gives you access to
the same instance of "data" everywhere on a form.
Regards,
Witold Szczerba