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

Directives link API documentation did not describe or mention the controller param. #13028

Closed
wants to merge 4 commits into from

Conversation

hahla
Copy link
Contributor

@hahla hahla commented Oct 6, 2015

The 4th param for link() was not defined in the api doc, but used in the examples. This change adds the param and describes it.

The 4th param for link() was not defined in the api doc, but used in the examples. This change adds the param and describes it.
@Narretz Narretz self-assigned this Oct 6, 2015
@Narretz Narretz added this to the Backlog milestone Oct 6, 2015
@gkalpak
Copy link
Member

gkalpak commented Oct 7, 2015

It is not that simple 😄

Basically, there is a fifth parameter (transcludeFn) and the controller(s) paremeter value depends on several factors. I suggest you briefly mention the 5 parameters and link to $compile API docs for more info.

@hahla, could you make that change ?

@hahla
Copy link
Contributor Author

hahla commented Oct 7, 2015

Yes sounds good, will update
On Tue, Oct 6, 2015 at 11:43 PM Georgios Kalpakas [email protected]
wrote:

It is not that simple [image: 😄]

Basically, there is a fifth parameter (transcludeFn) and the controller(s)
paremeter value depends on several factors. I suggest you briefly mention
the 5 parameters and link to $compile API docs
https://docs.angularjs.org/api/ng/service/%24compile#-link- for more
info.

@hahla https://github.com/hahla, could you make that change ?


Reply to this email directly or view it on GitHub
#13028 (comment).

Sent from my iPhone

@gkalpak
Copy link
Member

gkalpak commented Oct 7, 2015

Fantastic !
Feel free to ping me when you're done, so I can take another look.

@Narretz Narretz removed their assignment Oct 7, 2015
Adds reference to $compile for link function parameters and gives quick intro
to 5th param transcludeFn which was also missing in doc.
@hahla
Copy link
Contributor Author

hahla commented Oct 7, 2015

@gkalpak updated and ready for your review


* `scope` is an Angular scope object.
* `element` is the jqLite-wrapped element that this directive matches.
* `attrs` is a hash object with key-value pairs of normalized attribute names and their
corresponding attribute values.
* `controller` is the controller for the directive, if defined.
* `transcludeFn` is a transclude linking function pre-bound to the correct translusion scope.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translusion --> transclusion

@gkalpak
Copy link
Member

gkalpak commented Oct 8, 2015

@hahla, thx ! I left a couple of comments.
I wonder if can link directly to https://docs.angularjs.org/api/ng/service/$compile#-link-.

LGTM with the comments addressed.

Updates high level overview for directive link function based on PR comments
@hahla
Copy link
Contributor Author

hahla commented Oct 10, 2015

@gkalpak few comments:

  • I tried to link (no pun intended ;)) to the $compile.link function, but was unable to. Then I read more closely your comment "..$compile#-link-..." and got it working. Great!
  • I did another round of edits to improve readability in the context of the article example ("build a directive to display the current time"), while giving the key information on the link function. I decided to not copy the full description of the controller parameter because it was going to be a bit too detailed at this point in the docs and would be distracting to have sub-bullets.
  • added an alert-info to the page which gives a clear link for more detail on the $compile API.

screen shot 2015-10-10 at 1 23 43 pm

Anyway let me know what you think.

@hahla
Copy link
Contributor Author

hahla commented Oct 14, 2015

@gkalpak Looks like there was a CI error with the protractor execution, but I don't see any code errors on my side? How do we get Travis CI to re-run the tests, or should I send in a no-op commit to re-trigger the CI test?

@gkalpak
Copy link
Member

gkalpak commented Oct 14, 2015

LGTM. I restarted the job (it was indeed a flake).
I'll merge if Travis is happy.

Thx @hahla for working on this 👍

@gkalpak gkalpak closed this in 914a934 Oct 14, 2015
gkalpak pushed a commit that referenced this pull request Oct 14, 2015
The `controller` and `transclude` parameters of the linking function were not
mentioned in the description, but used in the examples.
This commit improves the description and links to the `$compile` API docs
for more details.

Closes #13028
@gkalpak
Copy link
Member

gkalpak commented Oct 14, 2015

Backported to v1.4.x as 8a944b0.

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

Successfully merging this pull request may close these issues.

4 participants