Live data from Hacker News

Angular 2 Final Released

angular.io

21–30 of 452 posts

Re: Angular 2 Final Released

#21

As someone who uses Angular 1 currently but would pick React for their next project, I'd love to see a list of reasons why I should use Angular 2 over React. If nothing else, Angular just stranded all their developers, while React has a huge head start on mindshare/plugins/tutorials/etc.

I like the opinionated approach of NG2 over the flexibility of React because it takes a lot of decisions off of me that i am not too interested in when building a new project. I am a full stack developer leaning more towards backend in recent years and i found setting up and finding out about best practices and "what to use" for React a bit tedious, also it changes so much. The last Flux framework i used was alt.js which was popular last year but is hardly used anymore.

I also really like Typescript and believe enforcing it is a good way to get general JS code quality up.

Re: Angular 2 Final Released

#23
I have been using Angular 2 for 3 months now and so far have loved it (except for the breaking changes in RC series and updating each time). Glad 2.0.0 is here. Here are the few things I loved, amongst other interesting features:

1. Typescript awesomeness: You can write plain JS or give type hints in Typescript. Typescript is awesome, because it is a superset of Javascript and compiles to Javascript. (Typescript > ES6 > ES5)

2. Modular code: It is is much easier to manage Angular code as it grows (compared to AngularJS). Components could be made independently and reused within other components using component interaction [1] (@Input, @Output)

3. Template Directives: .html template directives are available unlike ReactJS. A ReactJS vs Angular2 blog post online [1] argued that that putting HTML in Javascript is better than putting Javascript in HTML. I'd argue that template directives like ngFor, ngIf, etc are much simpler to understand. Also, it is easier to collaborate with a designer/half-developer who knows some html/scss and doesn't know Javascript than working in ReactJS where every collaborator has to know JS. This way, it is also easier for someone to gradually learn the framework. For me, template directives are a big win. If someone wants to construct templates with plain JS, that is still possible in Angular.

4. @angular/router is better than AngularJS routing and we don't have to use a 3rd party library (like ui-router was more popular in AngularJS than the angularjs router)

One thing that I have found annoying is that: UI libraries for Angular. Example: material2 (currently at alpha.8) [3] are not complete yet and lack several useful components. This can be a problem if you are looking to quickly build a complete, good looking UI. Hopefully, now with Angular 2.0.0 out; Angular team could focus on quicker development of material2, so we have all the AngularJS Material UI goodness with Angular.

[1] https://angular.io/docs/ts/latest/cookbook/component-communi... [2] https://medium.freecodecamp.com/angular-2-versus-react-there... [3] https://github.com/angular/material2

Re: Angular 2 Final Released

#24
post #2

Front end development is crazy these days. I remember on my road to learning Java EE banging my head on the wall trying to put together things like dependency management with Maven, ORM's, and all sorts of arcane concepts and patterns. It took me a long time to get to that point but now it seems all too familiar. As someone coming up to speed with frameworks like React and Angular 2 it feels like that all over again.

That's funny; as someone familiar with React, Angular, etc., the Java ecosystem seems utterly impenetrable.

Re: Angular 2 Final Released

#25

I expected angular.io to be a flashy example Angular 2 SPA and was disappointed when I realized it was just a regular old static HTML website. I guess most of the content is more suited for a static site. At least the search bar on the docs page looks like it has some Angular going on. Also it would be neat if the docs had dynamic examples instead of screenshots.

It actually is an Angular 1 app, for a very simple reason: when the docs site was started, Angular2 wasn't fully usable yet! There is an effort underway to rewrite it in Angular2, so it will be eventually.

Re: Angular 2 Final Released

#26

As someone who uses Angular 1 currently but would pick React for their next project, I'd love to see a list of reasons why I should use Angular 2 over React. If nothing else, Angular just stranded all their developers, while React has a huge head start on mindshare/plugins/tutorials/etc.

All three frameworks are excellent at helping us build ambitious front-end applications; you simply can't go _wrong_ by picking one over the other. If a particular framework's trade-offs don't for any part of the app (performance for example), you can always write just that part in a different way (manual DOM manipulation).

But to contrast all three, I'll pick the area I'm most interested in - templating. The purpose of a framework is to render a dynamic view without the programmer having to wire up every state transition with a corresponding view transition. This is done by templating content with state, mediated by the framework. And how this is done affects the entire design of the framework and apps written on them.

Angular and Ember allows state and logic inside HTML. They figure out which state variables and corresponding templates go together and re-renders them automatically. The pro is that writing a modified version of HTML without too much code lets us have a dynamic app running in no time. The con is that there is a new language to study - with its own parser, control structures, scoping, and quirks.

React on the other hand lets us specify templates as Javascript functions which are run whenever the state changes. The pro is that there is no new language abstraction to learn; it re-uses Javascript. External DSLs especially are in an uncanny valley - they're not full-blown languages but have enough quirks to be bothersome. Language abstractions forces a virtual machine (the language parser/interpreter) to evaluate the code, and it is an opaquely magical layer that makes it hard to see the entire stack of abstractions during day-to-day programming. It also forces a separation between our view (written in the templating language) with the rest of our code.

The con of this approach is simply more code to write; the programmer has to anticipate and inform the framework of any state changes. With setState this isn't as bad a trade-off as we'd imagine. And MobX meanwhile brings an Angular like state abstraction to React - it watches over observables and automatically fires re-render.

The other big difference is that React is not opinionated. It is a very much a framework alright, but it for example doesn't ship with a router, nor does it prescribe a framework for organizing the code. Ember has so far done a great job here - I often wish I could combine the Ember ethos of backwards compatibility, great documentation, and a fanatic love for the existing users of the framework, with the way React approaches templating and composing components. I haven't had the chance to look at Angular 2, but for me, Angular 1 started the front-end revolution happen, and I'm curious what they have done this time.

Re: Angular 2 Final Released

#27
post #23

I have been using Angular 2 for 3 months now and so far have loved it (except for the breaking changes in RC series and updating each time). Glad 2.0.0 is here. Here are the few things I loved, amongst other interesting features: 1. Typescript awesomeness: You can write plain JS or give type hints in Typescript. Typescript is awesome, because it is a superset of Javascript and compiles to Javascript. (Typescript > ES…

Awesome - thanks so much for this from a team running 1.3 in production (and looking now at moving to 2).

Just curious if you are indeed saying that the built-in router allows you to do EVERYTHING you could do with ui-router (nested states / targeted views etc)? I was planning on sticking with ui-router-ng2 when we kick over to angular 2.

How about testing? Was that difficult moving test suites over?

Re: Angular 2 Final Released

#28
post #24
post #2

Front end development is crazy these days. I remember on my road to learning Java EE banging my head on the wall trying to put together things like dependency management with Maven, ORM's, and all sorts of arcane concepts and patterns. It took me a long time to get to that point but now it seems all too familiar. As someone coming up to speed with frameworks like React and Angular 2 it feels like that all over again.

That's funny; as someone familiar with React, Angular, etc., the Java ecosystem seems utterly impenetrable.

Yeah - we consult with an angular + Java group (for angular only) --- I can't understand half of what they are talking about when they talk about Enterprise level Java web projects. Java for Hadoop, Spark etc I work with daily.

Re: Angular 2 Final Released

#30

As someone who uses Angular 1 currently but would pick React for their next project, I'd love to see a list of reasons why I should use Angular 2 over React. If nothing else, Angular just stranded all their developers, while React has a huge head start on mindshare/plugins/tutorials/etc.

For big enterprise projects where there are many average developers, a full framework like Ember.js or Angular2 is practically easier to maintain.
Post reply on HN