-
Notifications
You must be signed in to change notification settings - Fork 871
docs(Displaying Data): copy edits #2435
Conversation
@@ -17,7 +17,7 @@ | |||
|
|||
"displaying-data": { | |||
"title": "Displaying Data", | |||
"intro": "Interpolation and other forms of property binding help us show app data in the UI.", | |||
"intro": "Property binding shows app data in the UI.", |
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.
Hmmm... I wouldn't say the binding shows it, it just enables showing it. Can you reword this?
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.
Changed to: "Property binding helps show app data in the UI."
:marked | ||
We typically display data in Angular by binding controls in an HTML template | ||
Angular typically displays data by binding controls in an HTML template |
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.
This changes the meaning. The dev specifies the binding, which enables the app to display property values. Can you think of another way to say this?
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.
Done.
@@ -17,42 +17,42 @@ figure.image-display | |||
img(src="/resources/images/devguide/displaying-data/final.png" alt="Final UI") | |||
|
|||
:marked | |||
# Table Of Contents | |||
# Contents |
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.
Do we usually use a first-level heading for Contents? (I'm actually not sure. I tend not to in my own writing, but I don't remember whether we've established a good precedent in these pages.)
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.
Good question. I did a global search and found that in readme files we tend toward ## but in the jade files we use #. I'll keep an eye out for consistency.
much more readable HTML. | ||
The backtick (<code>\`</code>)—which is *not* the same character as a single | ||
quote (`'`)—allows you to compose a string over several lines, which makes | ||
HTML more readable. |
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.
HTML -> the HTML
?
(It sounded funny to me.)
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.
Done.
the view such as a keystroke, a timer completion, or an async `XHR` response. | ||
We don't have those in this sample. | ||
But then the properties aren't changing on their own either. For the moment we must operate on faith. | ||
the view, such as a keystroke, a timer completion, or an async `XHR` response. |
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.
Why is XHR
in code font? I don't think it's a string you'll see in any code. Also, you already said "asynchronous" before, so "async" seems unnecessary. Maybe:
...a response to an HTTP request.
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.
Done.
This is a wonderfully concise and compact technique. | ||
|
||
Some folks prefer to declare the properties and initialize them within a constructor like this: | ||
You initialized your component properties using variable assignment. You could have |
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'm not crazy about "you" here, since they didn't make the decision. Can you think of a better way to phrase this?
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.
Done.
That's fine too. The choice is a matter of taste and organization policy. | ||
We'll adopt the more terse "variable assignment" style in this chapter simply because | ||
there will be less code to read. | ||
This page demonstrates the more terse "variable assignment" style simply for |
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.
Ward mentioned using "chapter" instead of "page" because "page" can be confused with the app. This is the first time I've noticed that problem, although I don't think it matters too much in this case which one you mean. Maybe:
This app uses the more terse...
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.
Good point. Changed.
each item in the `heroes` list. | ||
|
||
+makeExcerpt('app/app.component.2.ts', 'template') | ||
|
||
:marked | ||
Our presentation is the familiar HTML unordered list with `<ul>` and `<li>` tags. Let's focus on the `<li>` tag. | ||
This presentation uses the HTML unordered list with `<ul>` and `<li>` tags. The `*ngFor` |
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.
presentation -> UI
?
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.
Agreed. Done.
it is an example of a [template input variable](./template-syntax.html#ngForMicrosyntax). | ||
it is an example of a template input variable. Read | ||
more about template input variables in the [microsyntax](./template-syntax.html#ngForMicrosyntax) section of | ||
the [Template Syntax](./template-syntax.html) page. |
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.
good x-ref!
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.
Thanks! That one took me a minute to sort out. :)
We are defining our data directly inside our component. | ||
That's fine for a demo but certainly isn't a best practice. It's not even a good practice. | ||
Although we won't do anything about that in this chapter, we'll make a mental note to fix this down the road. | ||
You are defining your data directly inside the component which isn't best practice. |
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.
which -> , which
(as a rule, use either "that" or ", which", depending on whether the phrase is restrictive—can't be dropped without changing the meaning—or nonrestrictive)
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.
"you" sounds a little accusatory here. Maybe:
This app's code defines the data directly inside the component, which...
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.
Done.
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.
You input the editor's changes well, but I think we need to use "you" much less often. Also, in many cases the editor changed intros to something that looked like a command.
That's fine for a demo but certainly isn't a best practice. It's not even a good practice. | ||
Although we won't do anything about that in this chapter, we'll make a mental note to fix this down the road. | ||
You are defining your data directly inside the component which isn't best practice. | ||
For illustrative purposes, however, it's fine. |
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.
Not sure that "illustrative purposes" is the best phrase here. Maybe... "a simple demo"?
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.
Done.
most of the time we're binding to more specialized objects. | ||
|
||
Let's turn our !{_array} of hero names into !{_an} !{_array} of `Hero` objects. For that we'll need a `Hero` class. | ||
At the moment, you're binding to !{_an} !{_array} of strings. |
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.
Again, the "you" seems unnecessary here. Maybe:
you're binding -> the data binding is
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.
Done.
|
||
Let's turn our !{_array} of hero names into !{_an} !{_array} of `Hero` objects. For that we'll need a `Hero` class. | ||
At the moment, you're binding to !{_an} !{_array} of strings. | ||
Most of the time you'd bind to more specialized objects. To do this, turn your !{_array} |
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.
Most of the time you'd bind to
->
In real applications, most bindings are to
To do this, ...
->
(new paragraph)
To convert this binding to use specialized objects,
turn the !{_array}...
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.
Done.
|
||
It might not look like we have properties, but we do. We're taking | ||
advantage of a TypeScript shortcut in our declaration of the constructor parameters. | ||
It might not look like you have properties, but you do. You're taking |
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.
Let's do more de-you-ification:
you have -> the class has
you do -> it does
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.
Done.
It might not look like we have properties, but we do. We're taking | ||
advantage of a TypeScript shortcut in our declaration of the constructor parameters. | ||
It might not look like you have properties, but you do. You're taking | ||
advantage of a TypeScript shortcut in your declaration of the constructor parameters. |
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.
Change this last sentence to avoid the "your":
The declaration ... parameters takes advantage of ... shortcut.
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.
Done.
At the moment it displays the hero's `id` and `name`. | ||
Let's fix that so we display only the hero's `name` property. | ||
Fix that so you display only the hero's `name` property. |
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.
so you -> 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.
Done.
|
||
+makeExcerpt('app/app.component.3.ts', 'template') | ||
|
||
:marked | ||
Our display looks the same, but now we know much better what a hero really is. | ||
Your display looks the same, but now you've clarified what a hero is. |
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.
Your -> The
now you've clarified ... is -> the code is clearer.
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.
Done.
|
||
.l-main-section#ngIf | ||
:marked | ||
## Conditional display with NgIf | ||
|
||
Sometimes an app needs to display a view or a portion of a view only under specific circumstances. | ||
|
||
In our example, we'd like to display a message if we have a large number of heroes, say, more than 3. | ||
In the example, you can display a message if there are more than three heroes. |
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.
"you can" seems misleading here. The point is not what you can do, but that you're going to do it conditionally. Maybe:
Let's change the example to display...
(I know, that uses "us", but I can't think of a clearer way to introduce what's coming next. Maybe you can!)
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.
Confession...I love "let's"! :D
Done.
That hardly matters here. But it would matter a great deal, from a performance perspective, if | ||
we were conditionally including or excluding a big chunk of HTML with many data bindings. | ||
Angular isn't showing and hiding the message. It is adding and removing the paragraph element from the DOM | ||
which improves performance, especially in larger projects when conditionally including or excluding |
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.
DOM which -> DOM. That
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.
Done.
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.
Done.
|
||
Here's our final code: | ||
Here's your final code: |
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.
your -> the
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'll be on the lookout for this same opportunity throughout. Done.
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.
Done.
2eed6f5
to
8c878e7
Compare
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.
One tiny word went missing, but otherwise looks great!
The app's code defines the data directly inside the component, which isn't best practice. | ||
In a simple demo, however, it's fine. | ||
|
||
At the moment, the binding is !{_an} !{_array} of strings. |
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.
is -> is 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.
Fixed!
b64eea9
to
0bd94dd
Compare
Copy edits in guide/_data.json and displaying-data.jade.