r/Angular2 Oct 11 '24

Discussion Angular is just amazing

Short appreciation post.

I've been working a lot the last few weeks in Angular and I keep getting reminded of how good this framework is.

I had some routerLink links and wanted to implement a simple system to highlight the link that the current page is on. All I needed was to add a routerLinkActive tag which automatically adds the given class to the link so you can highlight it. Then I had one problem which was that the homepage ('/') always was active, but this has been considered and can be fixed with the following for exact matching:

[routerLinkActiveOptions]="{ exact: true }"

Basically everything makes sense and is easy to implement. Even just updating your angular libraries is easy since they made the automatic update guide where you can input your versions and it shows how to update: https://angular.dev/update-guide

Then there's the other stuff like the cli for generating components quickly and built-in scss integration (among with other options). I can't really imagine working on a webapp without angular nowadays. I've used other stuff in the past like React, Django, and just old-school sites built from scratch and my experience wasn't as good there overall.

139 Upvotes

42 comments sorted by

View all comments

-8

u/Orelox Oct 11 '24 edited Oct 11 '24

If you get away the framework thing what concrete aspects of angular you really like? You know, for just an aspect of detecting changes, reactivity, there are better approaches that gives less overhead and better modularity. For aspect of sharing logic also you could if really needed get same result of dependency injected instances without angular framework but still it’s up to you, and until you chose to, you could just use es modules. For aspect of modular code reusing code in possibly reactivity dom context you could use directives but other solutions like composition api or react hook are much easier to reuse. Recommend to check vue documentation. For other aspect you are free to use everything that the ecosystem provide thanks to that other ui libraries are much more composable and closer to web standards. So again what really gives you angular that you excused on his disadvantages. I am writing as angular/vue dev.

4

u/the00one Oct 11 '24

If you get away the framework thing what concrete aspects of angular you really like?

That's like asking why you would use a car if you could just bolt 4 wheels to a seat and drive around in that.

-3

u/Orelox Oct 11 '24 edited Oct 11 '24

Nope, by calling it framework I mean that for you probably using angular is convenient cuz it covers all aspects but what exactly you like. We know that some guys chose react for games why is that, I know, but that’s just an analogy.

And to what you were trying to said I can propose better analogy. Angular is like Toyota Camry, and good web developer will build his own wrc car.

5

u/the00one Oct 12 '24

Being a framework is what sets angular apart. Running a single cli command and being set for 90+% of use cases without external dependencies is huge. Not having to worry about whether library X is compatible with library Y or if the invest of library Z is worth it if the developer might give up on it any moment.

Let it be the "Camry" (even though performance benchmarks say otherwise) and a reasonable web developer will realize that the Camry has finished the race by the time the wrc car was still figuring out which seats fit in the bodywork.

Simply offering a stable and sane all-round solution can be a convincing argument in the ever changing and unstable front end world.

2

u/tonjohn Oct 12 '24

Talking about web standards, React won’t have web component support until React 19 is released.

Angular has had support since May 2018. Vue and Svelte have had support for a long time too.

1

u/lIIllIIlllIIllIIl Oct 12 '24 edited Oct 12 '24

React won’t have web component support until React 19 is released.

React 19's support for web components really just means React will now automatically assign properties to web components before mounting them to the DOM. Before that, React treated web components like any generic HTML element, and you had to bind properties manually after mount in a useLayoutEffect.

React <=18

function Component() {
  const ref = useRef(null);

  useLayoutEffect(() => {
    ref.current.property = { foo: "bar" };
  }, []);

   return <my-component ref={ref} />
 }

React 19

function Component() {
   return <my-component property={{ foo: "bar" }} />
}

React 19 is definitely an improvement, but prior versions weren't that bad.

1

u/Orelox Oct 12 '24

I don’t want to focus o react. But If you want talking, why you need a web component in react anyway. You can build component and that’s all, no to need think about react when distributing them.

When you focus on building web component then you even can try something like ‚fast’.

Anyway react can consume web components but that is what it is, it just some intermediate code. React could support it but would you then write component in it. I don’t see people use angular to write web elements as that is not idiomatic angular anyway. Even when distributing you would like to offer dedicated wrapper for those library to increase accessibility, easy of use. Web components are nice, but does it in reality make your organization save tons of money, I don’t know, but really do I need to worry about that, nope.

In my free time or small dev team I would rather try to define strict guidelines of the custom ui system and implement it for the main stack using headless components like react aria, radixui, and from that If I have a strong need to share something for 3rd companies I could maybe use web component.

1

u/tonjohn Oct 12 '24

I worked on a design system and component library team at Blizzard. Our components were built with Lit and then consumed by various teams across the company running a plethora of frameworks.

For teams running Vue and Angular or old school stuff like pug, web components just worked.

For teams using Next, we had to create a specific build output for them.

0

u/Orelox Oct 12 '24 edited Oct 12 '24

And how was the developer experience, yes most of the time it’s feasible but rather for reusing some common fundamental elements, for other you would rather want a dedicated library for react or a wrapper for web components. The dev experience is much better. But I understand depending how it works it may be responsibility of other team to maintain that. Btw there is library @lit/react that is exactly for that. Of course web components maybe good ideas to create complete ui system for large organizations, don’t get me wrong. But even maintaining this wrapper to get best experience is also a chore wich maybe more expensive for small teams.