Updated code example to build array of Hero #407
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
You are right. OTOH, there is a large issue that concerns us. This part of the code isn't an important point for the tour ... more of a distraction really. We want to keep the reader's eyes on the prize. My instinct is that your solution adds complexity without much _Angular 2_ insight. Perhaps we'd better off saying ...
Or perhaps we should give the I want to think about it. I'm leaving this open while I do. That said, thanks for your close reading of the text and thoughtful comment. We need that kind of help. Keep your eyes on this and see how we decide. And keep those suggestions coming. |
Understandable @wardbell . It doesn't add to the Angular 2 tutorial. That being said, if we aren't using the |
Having the type there (even if it's not a real instance of IIRC as far as typescript tooling is concerned, if you say it's a This is what I get in Atom if I try to say put a fake hero object that doesn't have an EDIT: just checked and typescript will even complain if you put extra properties in there, that |
Also ... you've only seen the first two chapters of the tutorial. The That you haven't seen the rest of the tutorial is entirely my fault. @johnpapa wrote it; it's up to me to get it published ... and I have been tardy in doing so. Intend to fix that soon. |
Ah, good to know. Thanks again for looking this PR over. I'm happy to close On Thu, Nov 26, 2015, 5:17 PM Ward Bell notifications@github.com wrote:
|
Previously the instructions indicated that this builds an array of Hero instances:
This actually builds an array of Object instances as we are not instantiating
Hero
. This is confusing as a user would think they can add a function to theHero
class and access it via an instance.In order to instantiate an array of Hero instances, we need to map over the array and instantiate
Hero
for each entity:Now we have an array of Hero entities: