New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: comments/suggestions/typos for the Angular tutorials on MDN #41811
Comments
@gkalpak |
Thx for the comment, @destus90. What you say is true, but for v12+. The tutorial uses v11.2.5, so we still need to use the |
Do we have a pr for this? Or can we pick it up? |
I don't think these can be fixed via PRs (since the tutorials leave on the MDN docs). |
Okay |
Yes, I think those changes have to be made on the MDN site. I can look into when we can get these updates in. Contributions are also always welcome! :) Thanks for reviewing the content, @MrJithil ! |
I'm adding the devrel label for awareness if the team like to do some updates on this external page. cc @twerske / @MarkTechson |
Below are some comments/suggestions/typos for the Angular tutorial series on MDN:
Throughout the tutorial series:
to do
andto-do
are used inconsistently 馃槺 馃槺 馃槺 馃槆In Getting started with Angular:
Suggestion:
I believe
https://www.npmjs.com/get-npm
is a better URL (which is also what we use in ourREADME.md
). The current URL (https://docs.npmjs.com/cli/install
) is about thenpm install
command and not about installing thenpm
CLI.Suggestion:
...for consistency, since "Node.js" is used without backticks in several other places in the tutorial.
The tutorial recommends creating a project in the
Desktop
directory. I think this is not a great idea, because not all OSed have aDesktop
directory and for some that do have one (such as Windows), it is not a good practice to create large directories on theDesktop
(as it can slow down the whole system).Nit (it is more common to use uppercase letters in key combinations):
Also, does this work on macOS?
WRT "
app.component.ts
: Also known as the class":That sounds weird 馃榿 I've never heard anyone calling this "the class" 馃槂
Cold this be a typo (for example, missing a word or something)? Maybe "
AppComponent
class" or "component class"?WRT _"TypeScript offers [...] a more concise syntax than plain JavaScript"
That's quite a controversial statement. TypeScript offers many benefits, but coinsisement over plain JavaScript is hardly one of them 馃榿
Suggestion:
Suggestion:
}) - export class ItemComponent {
Suggestion:
}) - export class AppComponent {
(3x)
WRT "write your HTML within backticks":
That sounds arbitrary 馃榿 It is not necessary to use backticks (vs regular single/double quotes) and linters often bark at you if you unnecessarily use backticks. The template is a regular string literal and we should not recommend a particular way of creating it imo.
Suggestion:
In Beginning our Angular todo list app:
Suggestion:
}) - export class AppComponent {
Suggestion:
WRT
export class AppComponent { /* ... */ get items() { ... } }
:I don't think it is a good idea to use a getter like this. It doesn't have any benefit over a regular method (afaict) and it covers up the fact that accessing the property results in a function invocation.
Also, I don't think it is a good idea to use an array-returning function with
*ngFor
as it can result in many unnecessary invocations. I believe it is better to use a property (and update the value of that property every time the filter criteria change).Suggestion:
WRT "Pressing the Enter key also resets the value of
<input>
to an empty string. Alternatively, the user can click the Add button which calls the sameaddItem()
method.":When pressing the Add button, the input's value is nore reset. It sounds like a bad idea to have different behavior when pressing Enter vs clicking the Add button.
One solution could be to pass the
newItem
<input>
into theaddItem()
method and let it reset the value to the empty string.In Styling our Angular app:
Adding styles for
body
in theapp.component.css
is certainly not a good idea (and does not have any effect in most cases - i.e. unless one uses ViewEncapsulation.None).Suggestion:
I think it is a good idea to make it more explicit that styles in a component CSS file only affect elements inside that component's template (and nothing outside the component) - by default at least.
In Creating an item component:
Suggestion:
WRT "The template variable,
#editedItem
, on the<input>
means that Angular stores whatever a user types in this<input>
in a variable callededitedItem
."This is not very accurate. Angular stores a reference to the
<input>
element ineditedItem
. (From that, we can access whatever the user has typed in the<input>
via the element'svalue
property:editedItem.value
)Suggestion:
Suggestion:
WRT "this.allItems.splice(this.allItems.indexOf(item), 1);":
This is not a safe way to remove an item, because if the item is not in the list, then the last item will be removed.
A better way is
this.allItems = this.allItems.filter(otherItem => otherItem !== item);
.Suggestion:
WRT "which is bound to the
remove
property in theItemComponent
":This is a little confusing imo. It gives the impression that you can somehow bind methods to arbitrary child-component properties, which is not true.
ItemComponent#remove
is not a regular property; it is an@Output
.Maybe change that clause to "which is bound to the
remove
output in theItemComponent
"WRT "The following CSS adds basic styles, flexbox for the buttons, and custom checkboxes.":
This is a little confusing as well, since the styles below have very little to do with Flexbox for buttons. Maybe we meant "colors for buttons"?
In Filtering our to-do items:
In MDN: Building Angular applications and further resources:
Suggestion:
Suggestion:
I think it would be worth mentioning the various deploy schematics that allow you to deploy your app to various backends (sudh as GitHub pages, Firebase, Netlify, etc.) with a single command.
The text was updated successfully, but these errors were encountered: