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