Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Controller argument description in directive link function documentation is wrong #10815

Closed
dorellang opened this issue Jan 20, 2015 · 1 comment

Comments

@dorellang
Copy link

The docs say in the link function argument list (https://docs.angularjs.org/api/ng/service/$compile)

controller - a controller instance - A controller instance if at least one directive on the element defines a controller. The controller is shared among all the directives, which allows the directives to use the controllers as a communication channel.

But this is not true as of version 1.3.x. Currently the value of this argument depends on whether the directive require list has been defined; if it has, then controller is actually a list in which the i-th value is the controller instance of the i-th directive in the require list. Else, controller is just the directive's controller instance (or undefined if it doesn't have one).

Probably I should have sent a PR or something with the correction, but since my English kind of sucks I haven't.

@Narretz
Copy link
Contributor

Narretz commented Jan 21, 2015

Yeah, that's true:
One correction to your correction:
If you use
require: 'ngModel'
then controller is not an array. It's only an array if require is an array.

@Narretz Narretz self-assigned this Feb 24, 2015
Narretz added a commit that referenced this issue Mar 22, 2015
Also add "bindToController" to exampe directive definition object.

Closes #10815

Conflicts:
	src/ng/compile.js
netman92 pushed a commit to netman92/angular.js that referenced this issue Aug 8, 2015
Also add "bindToController" to exampe directive definition object.

Closes angular#10815
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants