New Angular Router api-s are really next level 🚀🤩!
- CanMatch guard: use the same route for different components
- loadComponent: lazy load component at route level with default import
- Functional guards: Guard your route as easy as a function call away!
#angular
16🍬coming in Angular v16 🅰️
1.🚦 Signals
2.💦 Non-destructive hydration support
3.🏎 Esbuild dev-server
4.🎨 Material components token API
5.💎 Create standalone app schematics
6.📢 Required inputs
7.🚏 Bind route data to inputs
8.🧩 Set inputs in NgComponentOutlet
👇
#angular
I just published a new Open Source project that should be handy to every Angular developer that is updating the Angular version 🩺.
When updating the Angular version we have to make sure that we also update the external libs, and have to check them one by one if they have added
Here's how I structure my components now that everything is signal-based 🚦
- DI dependencies
- inputs
- models
- outputs
- view / content queries
- local state + computeds
- constructor with effect replaces ngOnChanges and other lifecycle hooks
- ngOnInit - initialization logic
Required inputs are coming 🔨!!
PR: (was closed but probably will be opened again soon)
Thanks to
@_crisbeto
🤩.
A 6 year old issue is going down 🚀!
#angular
Angular v15.1.0 was just released 🎉🤩
🚀 Self-closing tags on custom elements
🔥 Typescript 4.9 support
❤️ TestBed.runInInjectionContext is now available!
⚠️ CanLoad is deprecated now in favor of the more powerful CanMatch guard!
🪄 and more!
#angular
A new injectable was introduced called DestroyRef.
This makes the injectDestroy() function not depend on private api-s 🎉
takeUntil(this.destroy$) was just made easy ❤️!
#angular
Angular v16.0.0-next.0 was just released 🔥!
It includes Signals🚦, so you won't have to copy over the signals folder in order to play with them!
Also, no ngcc anymore 🎉, and as Alex said, it won't be missed 😆!
#angular
I just published A change detection, zone.js, zoneless, local change detection, and signals story 📚
It includes almost all the info I have about Angular's past, present, and future when it comes to change detection ✨
#angular
This week injectLazy was released 🚀
It's a utility function that helps you inject lazy imported services into your components ⚡️
It was inspired by both and (thanks to
@Jean__Meche
🙌)
Go give it a try and let me know in the
My first big PR was merged in Angular 🥳, and it's an extended diagnostic that notifies the dev to invoke an uninvoked function in the template 😁
#angular
What's coming in Angular v17 🔥
⚡️ New template syntax for if, for, switch (better performance, better readability, better DX, better type-checking)
📈 New list reconciliation algorithm
🚀 World class lazy loading using the new defer block
🏗️ New application builder that
Should I make this personal project Open Source 😃?
Tech stack used:
- Angular v17.3 (new inputs, outputs)
- Angular Material 3 (+ dark mode)
- Firebase (+ local dev)
- Tailwind (layouts and some styling)
- ngxtension (connect, computedAsync, injectParams)
#angular
To easily understand what Angular with Signals🚦 bring to the table just take a look at these two examples:
One is using Rxjs and today's
@Inputs
, while the other one uses Signals and the reactive inputs that are explained in the RFC.
It just gets easier 🎉!
#angular
What if 🌶️?
Angular smallest unit is not a component, but a template (ng-template).
What if we could create templates without needing to create a component 🤔?
Because templates require a context, it would be the props of it.
Here we get functional templates (not
Local Change Detection in Angular (component level) 🤔?
- How does it work currently?
When using async pipe or the signals in the template, Angular will use cdr.markForCheck() underneath.
That function will mark the component for check and all its parents until it reaches the
While you're still waiting for the secret to drop, here's something that will affect your apps for gooood 🔥!!
Angular just got local change detection when using signals 🤯🤯🤯🤯🤯🤯🤯!!!!
#angular
It's here. v18 will have support for default content in ng-content.
Thanks to
@_crisbeto
🙌 and to
@dylhunn
@DevVersion
who worked on the new template pipeline which made this possible 🚀🚀
#angular
Here's an example of functional guards that just landed in
#angular
v14.2.
Yes, we can use inject function inside the guard function.
How? Because the guard function will be executed in an injection context.
Thanks to
@AScottAngular
🥳
Built-In Control Flow RFC allows us to easily manage the flow of our templates with easy to use new syntax 🎉
It gets inspiration from
@sveltejs
🍓
Here's a before and after how it looks like 👇
#angular
#svelte
If you are having issues with Eslint & Prettier and the new control flow is not being formatted correctly.
Please make sure to update to these versions:
- "prettier": "3.1.0"
- "eslint-plugin-prettier": "^5.0.1"
Hope it helps!
#angular
Together with
@Nartc1410
we created an Angular Library that contains utility functions that we use everyday that are fully tested 🧪!
I present you: ngxtension 🚀
It currently includes:
- ✅ assertInjector
- ✅ createInjectionToken
- ✅ computedFrom
- ✅ injectDestroy
- ✅
Angular New Control Flow syntax looks like is coming in v17! 🎉
The new syntax will be the @-syntax and not the #-syntax.
I created some snippets to play with the new syntax and I explain them in the video below.
Let me know in the comments what do you think 🙌!
PR that
Remember our control flow RFC? Well, you shared your thoughts and we listened. We're made some important changes to this upcoming feature. Find out more in this blog post by Alex (
@synalx
):
Develop from anywhere, on any machine.
🎉 Introducing Project IDX, an experimental new project aimed at bringing your entire full-stack, multiplatform development workflow to the cloud.
Learn more ➡️
While Angular hasn't exposed any signals API-s from router or forms or other libs, I need them, so here are the queryParams and params as signals 😃
#angular
We just released Prettier 3.1! This release includes improvements to ternary operators formatting, a new `--experimental-ternaries` option, and support for
@angular
v17's Control Flow Syntax:
In the latest version of Angular we can now use fetch instead of xhr for the http client.
Why should you care? 🤷♂️
If you're going to deploy Angular in the edge (cloudflare workers or other edge runtimes) fetch is required to make the api calls.
Is this breaking?
No!
How to
What if I told you that using Input getters and setters, to convert inputs to something else before being used in the component isn't going to be necessary anymore?
Take a look at the before and after 👇
All this is possible to this new PR, thanks to
@_crisbeto
💪:
Angular latest next release is fully packed 🔥🔥
- Signals are finally stable!
- It includes the schematics to migrate templates to the new control flow ❤️!!
- Mutate method was dropped from signals
- Customization for HttpTransferCache
- Better toSignal typings
- Diagnostic
Angular will introduce an official migration schematic to migrate decorator-based Inputs to signal inputs 🎉
I will have to deprecate another schematic in ngxtension, love it ❤️!
#angular
How I see Angular in 2 years ⚡️!
Inspiration from:
- signals DX from
@solid_js
- control flow DX from
@sveltejs
- template syntax (bindings) from
@angular
- class based components from
@angular
- component authoring format from
@svelte
&
@vuejs
What do you think? Do you
Angular v18.2 is out 🎉!
Checkout the changelog to learn about all the goodies 🤌
This one includes the two new features I contributed in Angular 🎉
- feat(compiler): add extended diagnostic to warn when there are uncalled functions in event bindings
- feat(migrations): add
If I had to build an app that must scale I'd go with:
-
@angular
for everything out of the box experience
-
@NxDevTools
for build caching / tooling
- ngrx/store (
@ngrx_io
) for highly complex state that really needs an event driven architecture
- rx-angular/state &
Yes, takeUntilDestroyed is great but it’s not easy to migrate code to it. You either need to pass DestroyRef to it or use it in an injection context.
I already had a lot of destroy$ = new Subject<void>(); in my codebase and called next() and complete() in ngOnDestroy.
So, I
As Angular signals are coming to life, I wanted to share again the fact that it's ok to use function calls in the template, as long as we know what we're doing (memoizing those calls)!
In the screenshot below I've used the new angular reactive primitive.
#angular
✨A new feature is coming to Angular Router 🚀
We will be able to set a different browser URL from the one for route matching 🎉
Why it's needed?
This is useful for redirects where you want to keep the browser bar the same as the originally attempted navigation but redirect to
What do you think of this syntax highlighting for the new control flow?
And also, look at that switch block, with an inner for and defer block, how simple things become 🔥!!!!
#angular
New Angular Router api-s are really next level 🚀🤩!
- CanMatch guard: use the same route for different components
- loadComponent: lazy load component at route level with default import
- Functional guards: Guard your route as easy as a function call away!
#angular
Change Detection in Angular 🔨
- markForCheck - marks component and all ancestors as dirty -> top-down rendering is needed to bring the app to a stable state
- detectChanges - re-renders component and all its children -> If used too much can bring the app performance to its
Combining Signals and Observables may have been confusing till now, but with computedFrom it will be easier to understand and to work with.
Give it a try and let me know in the comments what do you think!
#angular
I don't know how to say it, but my post on Incremental Static Regeneration for Angular was published in the official Angular Blog itself 🤯 and I can't believe my eyes when I see it 🥹!
Read about the benefits and how to get started with ISR in Angular
What if your computed can cancel the previous API call, being it an Observable or a Promise 👀?
computedAsync does exactly that 🔥!
Checkout the PR in ngxtension for the details.
Play with it here:
#angular
Looks like next major Angular version v17 will use esbuild by default! 🔥
It's going to use the application builder (renamed esbuild-builder) which combines a lot of features together, without needing multiple types of builders like ssr, prerendering, ssr-dev-server etc.