angular.js icon indicating copy to clipboard operation
angular.js copied to clipboard

Comment in Developer Guide is confusing

Open Codier opened this issue 15 years ago • 4 comments

At this page: http://docs.angularjs.org/#!/guide/dev_guide.mvc.understanding_controller There is this comment "Standard prototypical inheritance between two controllers doesn't work as one might expect .....". This is a bit vague and confusing. Probably we can list cases that it does not work as expected(e.g. instanceOf) but comment that it works otherwise.

Codier avatar Jul 29 '11 21:07 Codier

Toni and I rewrote the controller docs from scratch. They are not part of the public docs yet. I need to make that doc public.

IgorMinar avatar Sep 09 '11 06:09 IgorMinar

Can you share with me the link?

Codier avatar Sep 13 '11 14:09 Codier

I don't think this is a problem (the text still remains), but I might just be acclimated to the terseness of the AngularJS documentation.

Closing this, but if anyone thinks this is still a problem, let me know and I'll re-open it.

btford avatar Nov 13 '12 18:11 btford

I think this is a problem.

As far as I can tell, this text:

Angular applies (in the sense of JavaScript's Function#apply) the controller constructor function to a new Angular scope object, which sets up an initial scope state. This means that Angular never creates instances of the controller type (by invoking the new operator on the controller constructor). Constructors are always applied to an existing scope object.

and this:

Note: Standard prototypical inheritance between two controllers doesn't work as one might expect, because as we mentioned earlier, controllers are not instantiated directly by Angular, but rather are applied to the scope object.

are false and needlessly misleading. This isn't a case of the documentation being terse; it's a case of it being wrong.

vin avatar Apr 21 '13 00:04 vin