docs(core): Add more docs of ViewChild and ViewChildren#7174
Conversation
aedd31c to
b19badf
Compare
|
@alexeagle Please review! |
|
@ericmartinezr Oops, you're right, thanks! It should be written following; I'll fix it. |
b19badf to
e3f5313
Compare
|
@laco0416 wow, I didn't know about that feature. It's still weird though that it doesn't allow spaces between the commas. I think you should specify for that case that there must be no spaces, or send a PR fixing it and allowing zero, one or more spaces. In either case, thanks for the hint! Didn't know about it! |
e3f5313 to
e52007d
Compare
|
@ericmartinezr Yes, I think also as you say. I'll send another PR for it ASAP! |
There was a problem hiding this comment.
This sentence doesn't make any sense to me. The old text is better IMHO. Even when the annotation name was changed from ViewQuery to ViewChildren it is still a query. Using the name of the element to document as main part of the documentation doesn't provide much value anyway. ("Foo" "This is a Foo")
What about something like
"When a field is decorated with @ViewChildren() Angular assigns a QueryList containing references to the elements that match the name or type of the argument passed to @ViewChildren(). Changes in the DOM that affect resulting elements update the content of the QueryList." (I hope the last sentence is actually true, but I think so)
There was a problem hiding this comment.
You're right. I'd like to use your sentence.
and, the last sentence is actually true. look at this! plunker
|
I'm not the subject matter expert here to review the correctness of what you've added, so attempting to dispatch... |
There was a problem hiding this comment.
Same, I can't imagine anyone getting any idea what this is about from this description.
"When a field is decorated with @ViewChild() Angular assigns a component, directive or ElementRef to the field. When the parameter passed to @ViewChild() is a string, an element with a template variable with this name is looked up in the view and a reference to that element is assigned to the field. If a type is passed as argument a directive or component with that type is looked up in the view and if found a reference to the directive or component instance is assigned to the field."
Not sure this is 100% correct though. The information about the parameters also applies to @ViewChildren and should probably be added there too.
|
@alexeagle oh, sorry. because I found your TODO comments in the code, I thought you are the best reviewer. |
2bdc73e to
8993129
Compare
8993129 to
e9588f6
Compare
There was a problem hiding this comment.
I'm wondering what happens when more elements match. Does it just assign the first it finds?
There was a problem hiding this comment.
yes, thanks! I'll add a sentence to explain it.
|
That's what I call documentation :) |
8f21d97 to
04d17a5
Compare
|
@zoechi thank you for your kind comments! 😃 |
|
@tbosch Please review :) |
There was a problem hiding this comment.
@alexeagle why did we duplicate this? So that tools show the docs correctly when writing an example?
There was a problem hiding this comment.
yes. in fact we have not duplicated enough - the properties of the object literal argument to our decorators don't have docs appearing in the editor
There was a problem hiding this comment.
so, should I keep duplicated docs?
There was a problem hiding this comment.
can you leave the TODO for me to fix this?
acf41b3 to
c61d688
Compare
|
@tbosch I fixed docs! |
|
@tbosch ping |
|
Please squash the commits and fix the travis, sorry this is taking so long, we are really busy and Tobias is the expert on this |
c61d688 to
aa35ab5
Compare
aa35ab5 to
bc54ac6
Compare
|
@tbosch done! Thank you @alexeagle |
|
thanks mate! |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add example which is easy to understand.
cc: @alexeagle