Live data from Hacker News

Angular 9.0

blog.angular.io

181–190 of 308 posts

Re: Angular 9.0

#181
post #74

Earlier quoted context omitted.

Don't use this library as an example of Angular code. I've written dozens of Angular apps and none of them were so over-engineered. AngularMaterial is a good example how to not design API. I'm sorry if it insults some people - we all make mistakes, it's ok, I'm sure you'll next library will be better and I understand it's too late to change API in a project, when some huge Google apps are using it.

Not only is @angular/material the most popular component library by a huge margin but it's maintained by the Angular team itself. If it's as bad as you say it is that really doesn't inspire confidence.

Yes.

Take a look at what you have to go through if you want to create a custom component in angular material (that can sit inside a form):

https://material.angular.io/guide/creating-a-custom-form-fie...

Something has gone completely wrong here.

Re: Angular 9.0

#182
post #88

The only thing I like about Angular is the dependency injection of services. Having "services" managed for you and just picking and choosing what you want is pretty nice. What I don't like is the verbosity and boilerplate... here's 2 examples: - Routing boilerplate is convoluted and time consuming. I think Nuxt.js has a much nicer implementation of SPA routing, where the filesystem is used to map the routes. - Angula…

Another benefit in my mind is that Angular is "batteries included" - you get everything you need in a single library, e.g. routing is a big one. From what I understand of React, you need to pick and chose the libraries (and versions of those libraries!) to use for your app, and then keep the versions of all the different libraries up-to-date and in sync with each other. Sounds like a maintenance nightmare.

It has probably been improved since I last tried it but this is one of the reasons I picked Angular over React. Having a router, HTTP client, forms, i18n, etc. out of the box compared to having to find/evaluate/integrate/maintain the various libraries that build on React to get the same functionality was a great benefit.

The other reason is the first class TypeScript and RxJS support.

Re: Angular 9.0

#183
post #171

Earlier quoted context omitted.

I joined a company that had two fairly simple internal web apps, one in Angular and the other one in React. Both had been written and maintained by a number of devs, each on the task for a few weeks or months. Both had several issues and blunders that needed to be fixed. However, while the Angular app had a very obvious, predictable structure, with issues confined inside single components or services, the react app w…

Anecdotal evidence. This is just the result of bad practices. React is less opinionated than Angular I'll give you that, so I guess that subpar angular might be preferable to subpar react. Well-managed react is incomparable in power. Try to make a library like react-three-fiber using Angular, in less than 500lines of code.

> Well-managed react is incomparable in power.

Unfounded opinion.

> Try to make a library like react-three-fiber using Angular, in less than 500lines of code.

react-three-fiber is much bigger than 500 lines of code.

Re: Angular 9.0

#184
post #88

The only thing I like about Angular is the dependency injection of services. Having "services" managed for you and just picking and choosing what you want is pretty nice. What I don't like is the verbosity and boilerplate... here's 2 examples: - Routing boilerplate is convoluted and time consuming. I think Nuxt.js has a much nicer implementation of SPA routing, where the filesystem is used to map the routes. - Angula…

Another benefit in my mind is that Angular is "batteries included" - you get everything you need in a single library, e.g. routing is a big one. From what I understand of React, you need to pick and chose the libraries (and versions of those libraries!) to use for your app, and then keep the versions of all the different libraries up-to-date and in sync with each other. Sounds like a maintenance nightmare.

Then again, that is what might lead to the boilerplate. I've been out of Angular for a while, but was kind of following along around the release of v2, where they went through about four routers, I think. GP mentions mapping routes to the file system, but then how are you going to accommodate a route pointing to a modal inside another route, identified by its hash? By having one blessed implementation, they also feel forced to support every potential use case.

Re: Angular 9.0

#185

I've been going down the long road of learning Angular recently, and I love it and want to learn more, but I have a couple naive newbie questions whose answers I thought should be obvious, but I haven't been able to figure out: Is there a standard way to define local variables in an Angular template so you don't have to repeat the same redundant expression again and again (or so you can at least give an expression a…

> Is there a standard way to define local variables in an Angular template so you don't have to repeat the same redundant expression again and again I usually define something in the component, and reference that. If you need to lazily evaluate it you can just reference a function in the component (e.g. "...{{ someFunction() }}...", and have the function do whatever lazy work and/or memoisation you need there. If you…

Thanks, that's great advice! Angular is really great when I can get away with just not worrying about the bomb -- it's amazing what little effort it takes (I just wish ng-component was spelled with only one or two letters). But there are still those things I'm used to being very easy to do in Genshi, that seem incredibly complicated in Angular, and don't leverage JavaScript. Granted they both have extremely different architectures, but local variables seem like a no-brainer, and lots of parts of Angular use them indirectly like ngIf and ngFor, but as far as I can tell, Angular just doesn't give you a pure direct form of ngLet that supports binding multiple local variables at once, for your own use. And ng-template is just weird.

I get the impression that is actually just directly exposing some low level implementation mechanism, and wasn't specifically designed to be a concise, powerful, general purpose, easy to use templating system, or behave in any way like JavaScript.

I keep trying to work my way through this otherwise pretty good tutorial:

https://blog.angular-university.io/angular-ng-template-ng-co...

>But besides that else template, the use of ngIf also creates a second implicit ng-template! Let's have a look at what is happening under the hood:

    
       
         ... 
       
    

    
        Loading...
    
>This is what happens internally as Angular desugars the more concise ngIf structural directive syntax. Let's break down what happened during the desugaring:

>the element onto which the structural directive ngIf was applied has been moved into an ng-template

>The expression of ngIf has been split up and applied to two separate directives, using the [ngIf] and [ngIfElse] template input variable syntax

>And this is just one example, of a particular case with ngIf. But with ngFor and ngSwitch a similar process also occurs.

At this point I'm starting to feel dizzy, like when Scorpius needs his cooling rod changed.

https://www.youtube.com/watch?v=U7SS0YCWVGs

But when I got to the stuff about ng-template with parameter attributes prefixed by "let-", and tacking ";context:ctx" on to the template outlet name, and then having to stick some instance variable into your component source code (which is usually a separate file), my eyes glazed over and my palm hit my forehead. It's like learning a whole new set of cult-like jargon and mythological concepts (Outlets??! Why so many layers of indirection and different names for the same thing?), instead of reusing anything I already know about JavaScript, simply to pass parameters to a template. Maybe this is just a bad example and explanation of ng-template, but I haven't found a better one yet.

    @Component({
      selector: 'app-root',
      template: `      
    
         Approximately {{lessonsCounter}} lessons ...
    
    
    
    `})
    export class AppComponent {

        totalEstimate = 10;
        ctx = {estimate: this.totalEstimate};

    }
That's how ZOPE METAL templates felt: it was such a big fucking ordeal to pass every single parameter through a named "slot", each wrapped in its own special outgoing and incoming namespaced XML tag, like COBOL with angled brackets. When it's all just clean simple Python underneath, but that's hidden from you, and you can't just use Python expressions and calling conventions, or XML attributes, or xpath, or define concise custom tags with attribute and content parameters, or write general purpose Turing-complete macros like Lisp.

Re: Angular 9.0

#186

Earlier quoted context omitted.

I've been doing Angular for 5+ years now. I think you might be using it wrong because I never experienced anything like that.

Angular has a lot of unique concepts that people find difficult to wrap their heads around. The Observable pattern, decorators, typescript, etc. When you throw things like NGRX and effective management of state / side-effects in the mix; things get exponentially more complex and difficult to scale. I have personally witnessed companies take guys who have been slapping together "apps" in jQuery / .NET for the past 10…

I haven't done much with Angular 2+ (I use Vue now), but in my Angular 1 days, I've definitely seen a lot of Angular apps that were basically put together like a jQuery app. Massive controllers, lots of dom manipulation and logic in the controllers. My approach at the time was that controllers should be as small and simple as possible, with most business logic, data models, communication, etc extracted to services. The controller should just connect the various parts, nothing more. But when you're used to unstructured jQuery, the controller is an obvious place to just put everything.

Re: Angular 9.0

#187

Why is Angular so less popular than React?

I have not done much react apart from a "hello world", but I have been using Angular2+ for years, having previously used AngularJS. Here are a few thoughts: The learning curve is steep I agree. There does feel like there is a lot of ceremony and boilerplate required for even the more basic "hello world". Also if you are not familiar with RxJS before learning Angular then that is a second learning curve that you need…

> Also if you are not familiar with RxJS before learning Angular then that is a second learning curve that you need to know too and it is a challenge.

You are not the only one mentioning this here. Do you believe it's wise to start with learning RxJS before you even approach Angular if you are a VanillaJS/JQuery "dinosaur" looking forward to learn Angular?

Re: Angular 9.0

#188

Why is Angular so less popular than React?

Opinionated (professionally engineered structure) vs. Simple template system. There’s no good or bad. As in any architectural adoption, it should’ve based on your team’s capabilities and support capabilities. Experience matters too. There are good reasons to use either platform.

Doesn't opinionated and professionally engineered structure mean "better"? Clearly most of the JS coders don't have expertise sufficient to engineer their structures professionally on their own - isn't it better to embrace a professionally engineered structure done for you for free?

Re: Angular 9.0

#189

After 2 years of Angular madness I will send my resignation and I hope I will never work with it again. My app is a big stack of workaround stuff that might break anytime. Because that is how angular work. Some stuff work in a context and doesn't in an other. Nobody's know why ! They have so much issue on Github that they need a bot to close them after a while. They hope the bug disappear by himself ?

I find it deeply ironic that, judging by the stories regularly posted and upvoted, Hacker News readers supposedly value science, rationalism, evidence-based thinking, etc. Yet the same people reliably upvote these kinds of toxic, detail-free, ungrammatical, emotional rants. By all means, upvote criticism that is properly argued and backed up with evidence. But upvoting these kinds of comments is the equivalent of pos…

Self-proclaimed skeptics are rarely skeptical about their skepticism.

Re: Angular 9.0

#190
post #55

Why is Angular so less popular than React?

I am working on creating a web app now and for some reason decided to learn Dart and AngularDart at the same and do it with these technologies and it's close to being nightmarish. There are way too many concepts and things that tie together sort-of magically -- all to get a few form fields on a screen. I wonder how people come back to fix issues or add features in their Angular app after a few months away from it. Th…

> decided to learn Dart and AngularDart

Why use anything but Flutter if you choose Dart?

Post reply on HN