-
Notifications
You must be signed in to change notification settings - Fork 870
docs(guide): add Dart Template Syntax example #377
docs(guide): add Dart Template Syntax example #377
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this from? Where is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is a great question! It's in the plunkr example at the bottom, but scanning through the the actual docs I don't see a reference to it anywhere.
@kevmoo ,@kwalrath do we want to scrub it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see _Color.Red used below. Is that what @kevmoo was referring to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kwalrath .Yep, at the very bottom of index.html in the TS example app there is a blurb about using enums in bindings. That's the part that references this enum and the colorToggle() method. What I meant to say was I don't see any reference to it in the actual tutorial. So I'm not sure if it was just scrubbed, or if it will be referenced at a later time.
On this note, I had a heck of a time trying to figure out how to use enums in Dart in the way that the TS example is using it. I'm not sure that what I ended up with is even right. Let me know if there is a better way to tell the same story here. Thanks.
|
@tomplusplus work through those fire set of items... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, this is where _Color is used!
|
I'm going to start on the tutorial now, fwiw... |
|
@kwalrath Let's chat tomorrow before you start the tutorial. The code I did here is actually the example for the new User Input example. It was a bit confusing since the Template syntax is almost identical. |
|
About my template syntax work: I've only been working on the text, not the code yet, so it's not too late to switch to something else. About the enums: @kevmoo what do you think we should do? I've never used enums in Dart, except to demonstrate very basic usage. Tom, let's chat on Slack later... I'll be offline for about an hour, but when I get back we can talk. |
a168174 to
eae8973
Compare
|
@kwalrath @kevmoo . Just updated this one to match the current TS example after Ward split out this form User Input. There were quite a bit of changes so it probably warrants another look through. Thanks Tom |
|
OK found a fix with @kwalrath for the above mentioned error. May still warrant some discussion if the fix is the right way to go. |
|
@kevmoo Do you have an opinion on the fix? I'm inclined to take this code as-is, so I can get started on the text. |
|
@tomplusplus please run dartfmt one more time – app_component needs some cleanup @kwalrath, @tomplusplus What "fix" are we talking about? |
|
The fix was to reuse maps ( |
|
Aaaargh! The problem Tom encountered is caused by DevMode and is NOT a problem with A2 itself nor should we be changing anything in our recommendations. A fast fix would have been to switch to ProdMode. DevMode will be reworked very soon so we don't get these false errors. I was going to go back and fix the TS version in the meanwhile so that it doesn't blow up (yes, it blows up for me too). I just hadn't gotten to it. Maybe that is the fix that you're talking about here re: maps. If so, I'll steal it. |
|
I guess we should cover these modes in the docs. It's slightly complicated by the fact that Dart has its own modes (checked vs production). However, it looks like prod mode doesn't work for Dart: angular/angular#5982, angular/angular#6189 |
|
Oh boy. We certainly do need to document those modes. We can take that up in a different issue/task. Returning to this PR: were the necessary sample changes "behind the scenes" or did they affect what we're telling our audience? Meanwhile, I can see that this PR only touches DART files. I will handle the TS sample code adjustments separately. Other than my question, I don't think I have anything to add here. |
|
I haven't started the Template Syntax docs yet, so I don't know whether these changes will be visible. I suspect they will be, though. |
|
Just getting back into this now. IMHO the current sample changes to make this work doesn't seem to effect anything we are telling the audience about Template Syntax or its use cases. But he code sample itself is different enough that I would suspect it may raise some questions. @wardbell Ill look today at the stuff you just recently committed for this sample :) |
…ng interpolation where it make sense. Fix `Library` syntax for `little_hero`. Add #docregion comment to all relevant files. Move const List to inline List in class declaration and set `currentHero` in constructor. Create constructor for `AppComponent` class.
…ke irrelevant sections.
…k with Dart syntax
…bute to pubspec.yaml and remove `CORE_DIRECTIVE` injection
ed2acfb to
d759f7f
Compare
|
Did you get a chance to look at Ward's changes? I think app-component.html should be app_component.html, but otherwise I'm inclined to take this as-is. We can always iterate... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this mean? I got the impression this is the preferred style currently?
|
I'm taking a look at this sample right now... |
|
I fixed a few issues and committed this. It still needs work, though. |
@kevmoo @kwalrath. Please review. This one was big, with a lot of the logic in the html template. I recreated the TS plunkr example, but there were quite a few things that didn't work quite the same. We can chat more about when Kathy is ready to write up the tutorial.