Auto unsubscribe in Angular π₯
#angular #decorator
β Link: https://medium.com/@sniadek97/auto-unsubscribe-in-angular-bcda939d6158
#angular #decorator
β Link: https://medium.com/@sniadek97/auto-unsubscribe-in-angular-bcda939d6158
Confirmation Dialog Decorator
#angular #decorator
β Link: https://itnext.io/confirm-dialog-with-decorator-in-angular-7491d1237667
#angular #decorator
β Link: https://itnext.io/confirm-dialog-with-decorator-in-angular-7491d1237667
π₯1
This media is not supported in your browser
VIEW IN TELEGRAM
π @Attribute Decorator in Angular
#angular #decorator #attribute
As you can see, when we trigger the change detection by emitting the click event, Angular is checking the value.
We can be more efficient in this case if we use the @Attribute decorator. With this change, Angular will evaluate it once and forget about it. As a general rule, I prefer the @Attribute() approach when the string is a fixed value that never changes.
#angular #decorator #attribute
As you can see, when we trigger the change detection by emitting the click event, Angular is checking the value.
We can be more efficient in this case if we use the @Attribute decorator. With this change, Angular will evaluate it once and forget about it. As a general rule, I prefer the @Attribute() approach when the string is a fixed value that never changes.
import { Component, Attribute } from '@angular/core';
@Component({...})
export class ButtonComponent {
constructor(
@Attribute('type')
public type: ButtonType = 'primary'
) {
}
}
β
Article Link: https://netbasal.com/getting-to-know-the-attribute-decorator-in-angular-4f7c9fb61243π1
π Debounce decorator in Angular
#angular #decorator #debounce
β οΈ Third-Party Lib
Usage example:
#angular #decorator #debounce
β οΈ Third-Party Lib
Usage example:
@Component({...})
export class ExampleComponent {
@Debounce(1000)
execute(arg: unknown) {
[ ... ]
}
}
β
Article Link: https://blog.bitsrc.io/3-ways-to-debounce-http-requests-in-angular-c407eb165adaβ€1
π Catch decorator in Angular
#angular #decorator #catch
β Article Link: https://javascript.plainenglish.io/a-try-catch-decorator-to-stylize-your-code-bdd0202765c8
π Code Link: https://github.com/omirobarcelo/catch-decorator/blob/master/src/index.ts
#angular #decorator #catch
β Article Link: https://javascript.plainenglish.io/a-try-catch-decorator-to-stylize-your-code-bdd0202765c8
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
π RunOutsideAngular decorator
#angular #decorator #ngZone
β Article Link: https://emilgadzaev.medium.com/achive-better-angular-application-using-typescript-decorators-9e0eb01ad72d
#angular #decorator #ngZone
β Article Link: https://emilgadzaev.medium.com/achive-better-angular-application-using-typescript-decorators-9e0eb01ad72d
π1
This media is not supported in your browser
VIEW IN TELEGRAM
π Throttle Decorator
#angular #decorator
β Article Link: https://netbasal.com/inspiration-for-custom-decorators-in-angular-95aeb87f072c
π Code Link:
Decorator
https://gist.github.com/NetanelBasal/db13a56407c76db8fe55d590ca4760c3#file-throttle-decorator-ts
Usage:
https://gist.github.com/NetanelBasal/0fcd8ed554c1ae7c9f961766db7465ac#file-throttle-usage-decorator-ts
#angular #decorator
β Article Link: https://netbasal.com/inspiration-for-custom-decorators-in-angular-95aeb87f072c
Decorator
https://gist.github.com/NetanelBasal/db13a56407c76db8fe55d590ca4760c3#file-throttle-decorator-ts
Usage:
https://gist.github.com/NetanelBasal/0fcd8ed554c1ae7c9f961766db7465ac#file-throttle-usage-decorator-ts
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
π Log Observable Property Decorator
#angular #decorator
β Article Link: https://netbasal.com/inspiration-for-custom-decorators-in-angular-95aeb87f072c
π Code Link:
Decorator:
https://gist.github.com/NetanelBasal/e457750f0235adcbead10cd28f609384#file-do-decorator-ts
Usage:
https://gist.github.com/NetanelBasal/d07658a3502086fb469d8cba1fcdbb97#file-do-usage-decorator-ts
#angular #decorator
β Article Link: https://netbasal.com/inspiration-for-custom-decorators-in-angular-95aeb87f072c
Decorator:
https://gist.github.com/NetanelBasal/e457750f0235adcbead10cd28f609384#file-do-decorator-ts
Usage:
https://gist.github.com/NetanelBasal/d07658a3502086fb469d8cba1fcdbb97#file-do-usage-decorator-ts
Please open Telegram to view this post
VIEW IN TELEGRAM
πUseful Decorators
#ts #decorator
β Article link: https://javascript.plainenglish.io/5-javascript-decorator-tricks-that-will-catch-your-eye-a31a717f5497
#ts #decorator
β Article link: https://javascript.plainenglish.io/5-javascript-decorator-tricks-that-will-catch-your-eye-a31a717f5497
π Create Paginated, Sortable and Filterable Endpoints with NestJs Decorators
#nestjs #decorator
β Article link: https://medium.com/@bhkfazano/how-to-create-paginated-sortable-and-filterable-endpoints-with-nestjs-fde6315c8466
#nestjs #decorator
β Article link: https://medium.com/@bhkfazano/how-to-create-paginated-sortable-and-filterable-endpoints-with-nestjs-fde6315c8466
π Card Composite via @ViewChildren in Angular
#angular #decorator #ViewChildren
β Article link: https://blog.stackademic.com/card-composite-via-viewchildren-in-angular-aa3317f92f82
#angular #decorator #ViewChildren
Imagine the following requirements for your Angular app:
- Your customer wants a view that displays multiple cards at once.
- A button at the top of the page should toggle the edit mode.
- While in edit mode, all cards are editable at the same time.
- As soon as you click βsaveβ only those cards that actually have been edited are going to send a request to the server.
- If you decide to discard the changes by clicking on βcancelβ all cards should be reset to their initial state.
This is a common scenario in any more sophisticated web application. Nevertheless, I just recently discovered a very handy way to handle those requirements in Angular. In this article I want to share my solution, leveraging the @ViewChildren property decorator to implement the Card Composite pattern.
β Article link: https://blog.stackademic.com/card-composite-via-viewchildren-in-angular-aa3317f92f82
π2π₯1
π§ͺ Attribute Injection in Angular: The HostAttributeToken Approach
#angular #decorator #attribute
π© > Angular 17.3
β Article link
#angular #decorator #attribute
Angular offers the @ Attribute decorator, facilitating the injection of attributes from the host node. It proves particularly handy when thereβs no necessity to establish a binding.
π© > Angular 17.3
β Article link
π1
π€ Replacing Static Inputs with the Host Attribute Token
#angular #decorator #Attribute #HostAttributeToken
π© > Angular 17
β Article link
#angular #decorator #Attribute #HostAttributeToken
π© > Angular 17
β Article link
π1