Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development: Migrate admin metrics Angular code to new best practices #9299

Merged
merged 11 commits into from
Sep 27, 2024
14 changes: 9 additions & 5 deletions docs/dev/guidelines/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,14 @@ The Artemis client is an Angular project. Keep https://angular.io/guide/stylegui

Some general aspects:

* The Artemis client uses lazy loading to keep the initial bundle size below 2 MB.
* The Artemis client uses lazy loading to keep the initial bundle size as small as possible.
* Code quality and test coverage are important. Try to reuse code and avoid code duplication. Write meaningful tests!

**Angular Migration**

* Use **standalone components** instead of Angular modules: https://angular.dev/reference/migrations/standalone
* Use the new ``signals`` to granularly track how and where state is used throughout an application, allowing Angular to optimize rendering updates: https://angular.dev/guide/signals
* Find out more in the following guide: https://blog.angular-university.io/angular-signal-components/
* Use the new ``signals`` to granular track how and where state is used throughout an application, allowing Angular to optimize rendering updates: https://angular.dev/guide/signals
* Find out more in the following guide: https://blog.angular-university.io/angular-signal-components
* Use the new ``input()`` and ``output()`` decorators instead of ``@Input()`` and ``@Output()``.

.. code-block:: ts
Expand All @@ -27,8 +30,9 @@ Some general aspects:
myOutput = output<string>();

* Use the new ``inject`` function, because it offers more accurate types and better compatibility with standard decorators, compared to constructor-based injection: https://angular.dev/reference/migrations/inject-function
* Use the new way of defining queries for ``viewChild()``, ``contentChild()``, ``viewChildren()``, ``contentChildren()``: https://ngxtension.netlify.app/utilities/migrations/queries-migration/
* Use ``OnPush`` change detection strategy for components whenever possible: https://blog.angular-university.io/onpush-change-detection-how-it-works/
* Use the new way of defining queries for ``viewChild()``, ``contentChild()``, ``viewChildren()``, ``contentChildren()``: https://ngxtension.netlify.app/utilities/migrations/queries-migration
* You can find an example for a migration in the pull request `9299 <https://github.com/ls1intum/Artemis/pull/9299>`_.
* Use ``OnPush`` change detection strategy for components whenever possible: https://blog.angular-university.io/onpush-change-detection-how-it-works

.. WARNING::
**Never invoke methods from the html template. The automatic change tracking in Angular will kill the application performance!**
Expand Down
Loading
Loading