-
Notifications
You must be signed in to change notification settings - Fork 27.5k
docs(tutorial): update to use v1.5.x
and best practices
#14416
Conversation
…s for the post-1.5.0 era This commit and the accompanying updates to the tutorial steps constitute a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5). Apart from the overall changes, two new chapters were introduced: one on components and one on code organization. -- In the process, several other things were (incidentally) taken care of, including: * Dependencies were upgraded to latest versions. * Animations were polished. * Outdated links were updated. * The app's base URL was changed to `/` (instead of `/app/`). BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine: * 0.11.16 * 4.2.6 * 4.4.2 * 5.10.0 -- This was inspired by (and loosely based on) angular#289. Mad props to @teropa for leading the way :) -- **Note:** The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the `pre-v1.5.0-snapshot` branch. The `v1.4.x` version of the tutorial should be pointed to that branch instead of `master`. -- Related to angular/angular.js#14416. Related to angular/angular-seed#329. Related to angular/angular-seed#333. --- Fixes angular#198 Fixes angular#214 Fixes angular#224 Fixes angular#230 Fixes angular#243 Fixes angular#246 Fixes angular#252 Fixes angular#277 Fixes angular#286 Fixes angular#295 Fixes angular#303 Fixes angular#304 Fixes angular#323 Fixes angular#324 Closes angular#268 Closes angular#270 Closes angular#278 Closes angular#280 Closes angular#289 Closes angular#309 Closes angular#311 Closes angular#319
This has to get merged simultaneously with corresponding PRs on:
Things that still need to be fixed:
Things that should/could be cosidered (potentially after this PR has been merged merged):
|
@gkalpak I can look into getting angular.io updated. I'll need to look into this branch in more detail to see the extent of the changes need to that guide, but in any case I'll bring it up with the docs team tomorrow. |
@teropa: Thx, that would be great ! Also, as you look through it, any feedback is more than welcome 😃 BTW, I tried to follow the structure that you used in the Upgrade Guide more closely, so hopefully you will be able to get rid of some of the noise in the guide and focus more on the new/different concepts. Big 👍 for your work on both #13834 and the Upgrade Guide. |
access to the `git` command line tool. The main commands that you will need to use are: | ||
|
||
* `git clone ...`: Clone a remote repository onto your local machine. | ||
* `git checkout ...`: Check out a particular branch or a tagged version of the code to hack on. |
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.
There is an annoying issue about corporate firewalls blocking git
angular/angular-phonecat#141
and probably
angular/angular-phonecat#235
Can we add this information into the guide?
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.
Added
```js | ||
// Register `phoneList` component, along with its associated controller and template | ||
angular. | ||
module('phonecatApp'). |
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 it officially recommended practice to "reopen" the module to add in the component?
Given that you are creating a new file anyway, why not have a one module = one file bijection.
The benefits of this are:
- you don't have to sort the files when building a distribution file
- you can easily move a file to another project without having to bring along its module definition
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 don't think it is explicitly mentioned anywhere, but this seems to be what john's styleguide is going throughout.
This is how I do it too fwiw 😛
Pros and cons of one module per file:
you don't have to sort the files when building a distribution file
👍
you can easily move a file to another project without having to bring along its module definition
The idea is that you are creating a module for the "least viable feature" - i.e. the smaller chunk of functionality that does something worth moving around or re-using in another project. So, there is no point in copying just the controller file of a component over to another project - you would copy the whole component directory instead(including the controller, controller spec, the module definition, the template etc).
Too many modules
👎
I don't think it's promoted as a good practice anywhere (at least I haven't seen it), so there might be few projects following this convention out there (I'm just speculating here).
👎
Could go either way (but only because I'm too tempted by not having to sort the files when bundling/testing 😛 )
I also have a slight concern about the overhead of creating a module for everything. I think there is a (tiny) bit of work involved in loading a module, which could add up.
Leaving it up to you 😁
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.
Ohhh! It's so hard to decide...
I am generally not in favour of reopening anything. Especially old milk bottles!
So I think I would rather go with one module per file:
- I don't believe that there is not so much of a performance penalty, because there is a similar cost to looking up the module when reopening.
- I believe that having small modules that explicitly declare their dependencies makes them a bit more self documenting.
- My feeling is that if things are so tightly bound that they should be in a single module then they should be in the same file??
If you do feel strongly @gkalpak then don't do it. But if you are not bothered then I would be delighted to see this changed :-)
Added a couple more fixups that move warning in a "Common Issues" section (in the introduction) and use |
Tasks for after getting this in:
|
LGTM |
v1.5.x
and best practicesv1.5.x
and best practices
…s for the post-1.5.0 era This commit and the accompanying updates to the tutorial steps constitute a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5). Apart from the overall changes, two new chapters were introduced: one on components and one on code organization. -- In the process, several other things were (incidentally) taken care of, including: * Dependencies were upgraded to latest versions. * Animations were polished. * Outdated links were updated. * The app's base URL was changed to `/` (instead of `/app/`). BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine: * 0.11.16 * 4.2.6 * 4.4.2 * 5.10.0 -- This was inspired by (and loosely based on) #289. Mad props to @teropa for leading the way :) -- **Note:** The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the `pre-v1.5.0-snapshot` branch. The `v1.4.x` version of the tutorial should be pointed to that branch instead of `master`. -- Related to angular/angular.js#14416. Related to angular/angular-seed#329. Related to angular/angular-seed#333. --- Fixes #198 Fixes #214 Fixes #224 Fixes #230 Fixes #243 Fixes #246 Fixes #252 Fixes #277 Fixes #286 Fixes #295 Fixes #303 Fixes #304 Fixes #323 Fixes #324 Closes #268 Closes #270 Closes #278 Closes #280 Closes #289 Closes #309 Closes #311 Closes #319
…s for the post-1.5.0 era This commit and the accompanying updates to the tutorial steps constitute a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5). Apart from the overall changes, two new chapters were introduced: one on components and one on code organization. -- In the process, several other things were (incidentally) taken care of, including: * Dependencies were upgraded to latest versions. * Animations were polished. * Outdated links were updated. * The app's base URL was changed to `/` (instead of `/app/`). BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine: * 0.11.16 * 4.2.6 * 4.4.2 * 5.10.0 -- This was inspired by (and loosely based on) #289. Mad props to @teropa for leading the way :) -- **Note:** The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the `pre-v1.5.0-snapshot` branch. The `v1.4.x` version of the tutorial should be pointed to that branch instead of `master`. -- Related to angular/angular.js#14416. Related to angular/angular-seed#329. Related to angular/angular-seed#333. --- Fixes #198 Fixes #214 Fixes #224 Fixes #230 Fixes #243 Fixes #246 Fixes #252 Fixes #277 Fixes #286 Fixes #295 Fixes #303 Fixes #304 Fixes #323 Fixes #324 Closes #268 Closes #270 Closes #278 Closes #280 Closes #289 Closes #309 Closes #311 Closes #319
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5). Apart from the overall changes, two new chapters were introduced: one on components and one on code organization. -- In the process, several other things were (incidentally) taken care of, including: * Dependencies were upgraded to latest versions. * Animations were polished. * Outdated links were updated. * The app's base URL was changed to `/` (instead of `/app/`). BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine: * 0.11.16 * 4.2.6 * 4.4.2 * 5.10.0 -- This was inspired by (and loosely based on) angular#13834. Again, mad props to @teropa for leading the way :) -- **Note:** The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the `pre-v1.5.0-snapshot` branch of [angular-phonecat](https://github.com/angular/angular-phonecat). The `v1.4.x` version of the tutorial should be pointed to that branch instead of `master`. -- Related to angular/angular-phonecat#326. Related to angular/angular-seed#329. Related to angular/angular-seed#333. --- Fixes angular#12755 Fixes angular#13312 Fixes angular#13623 Fixes angular#13632 Closes angular#8952 Closes angular#11726 Closes angular#12946 Closes angular#12947 Closes angular#13198 Closes angular#13284 Closes angular#13834 Closes angular#14178 Closes angular#14223
2c74a42
to
d7be60f
Compare
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5). Apart from the overall changes, two new chapters were introduced: one on components and one on code organization. -- In the process, several other things were (incidentally) taken care of, including: * Dependencies were upgraded to latest versions. * Animations were polished. * Outdated links were updated. * The app's base URL was changed to `/` (instead of `/app/`). BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine: * 0.11.16 * 4.2.6 * 4.4.2 * 5.10.0 * 6.2.0 -- This was inspired by (and loosely based on) #13834. Again, mad props to @teropa for leading the way :) -- **Note:** The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the `pre-v1.5.0-snapshot` branch of [angular-phonecat](https://github.com/angular/angular-phonecat). The `v1.4.x` version of the tutorial should be pointed to that branch instead of `master`. -- Related to angular/angular-phonecat#326. Related to angular/angular-seed#341. Closes #14416
…o the correct branch - Add a deprecation notice on the 'index' page. - Hide the "Live Demo" buttons (since we don't have a live demo). - Update the GitHub diff links to point to the `pre-v1.5.0-snapshot` angular-phonecat branch. - Modify all git commangs to use the appropriate branch and tags. Related to angular#14416.
This is a major reorganization of the Upgrade guide. * Compatible with the new version of the AngularJS 1 PhoneCat tutorial. * No longer switching Angular 1 code to SystemJS for PhoneCat, to allow beginning Angular 2 migration with fewer preparation steps. SystemJS switch now happens simultaneously with upgrade. (This is based on input from @joeeames) * Testing moved to an appendix to make the main narrative shorter and easier to follow. * Use component methods to do phone filtering and ordering instead of introducing pipes to replace filterFilter and orderByFilter. * Cover issue with camelCase inputs on downgraded components. For authors: * All examples now fully integrated with the example boilerplate. Uses the same Angular 2 version as all other guides. E2E tests are executed along with all the others. * Reduced number of PhoneCat versions from five to three. * Each directory has a README explaining how to run it and what might be peculiar about it. Closes angular/angular#8622 Relates to angular/angular.js#14416 Relates to angular/angular-phonecat#326
closes #1538 This is a major reorganization of the Upgrade guide. * Compatible with the new version of the AngularJS 1 PhoneCat tutorial. * No longer switching Angular 1 code to SystemJS for PhoneCat, to allow beginning Angular 2 migration with fewer preparation steps. SystemJS switch now happens simultaneously with upgrade. (This is based on input from @joeeames) * Testing moved to an appendix to make the main narrative shorter and easier to follow. * Use component methods to do phone filtering and ordering instead of introducing pipes to replace filterFilter and orderByFilter. * Cover issue with camelCase inputs on downgraded components. For authors: * All examples now fully integrated with the example boilerplate. Uses the same Angular 2 version as all other guides. E2E tests are executed along with all the others. * Reduced number of PhoneCat versions from five to three. * Each directory has a README explaining how to run it and what might be peculiar about it. Closes angular/angular#8622 Relates to angular/angular.js#14416 Relates to angular/angular-phonecat#326
…o the correct branch - Add a deprecation notice on the 'index' page. - Hide the "Live Demo" buttons (since we don't have a live demo). - Update the GitHub diff links to point to the `1.4-snapshot` angular-phonecat branch. - Modify all git commangs to use the appropriate branch and tags (e.g. `1.4-step-*`). Related to #14416. Closes #14675
This is a major re-structuring of the tutorial app's codebase, aiming at applying established best practices (in terms of file naming/layout and code organization) and utilizing several new features and enhancements (most notably components) introduced in recent versions of Angular (especially v1.5).
Apart from the overall changes, two new chapters were introduced: one on components and one on code organization.
In the process, several other things were (incidentally) taken care of, including:
/
(instead of/app/
).BTW, this has been tested with the following versions of Node (on Windows 10) and everything worked fine:
This was inspired by (and loosely based on) #13834.
Again, mad props to @teropa for leading the way :)
Note:
The old version of the tutorial, that is compatible with Angular version 1.4 or older, has been saved on the
pre-v1.5.0-snapshot
branch of angular-phonecat. Thev1.4.x
version of the tutorial should be pointed to that branch instead ofmaster
.Related to angular/angular-phonecat#326.
Related to angular/angular-seed#341.
Fixes #12755
Fixes #13312
Fixes #13623
Fixes #13632
Closes #8952
Closes #11726
Closes #12946
Closes #12947
Closes #13198
Closes #13284
Closes #13834
Closes #14178
Closes #14223