Live data from Hacker News

Angular 2 Final Released

angular.io

191–200 of 452 posts

Re: Angular 2 Final Released

#191
So I have never used Angular before but work with Vue. Looking at the tutorial, why is there the syntax of [(ngModel)] (equivalent would be v-model for me) and ngFor= (v-for)? Why are they different? It looks kind of unnecessary to me. I would really appreciate if someone explained it.

Re: Angular 2 Final Released

#192
post #141

Earlier quoted context omitted.

Of note, Facebook's create-react-app provides an "official' opinionated approach. https://facebook.github.io/react/blog/2016/07/22/create-apps... There's even a pull request to bring typescript into the mix. https://github.com/facebookincubator/create-react-app/pull/5...

I'm just writing a first React app, and read beforehand that it was going to be difficult to choose which libraries to use, and to get them to work together, but I haven't found that to be much of an issue in practice. create-react-app set up all the build tooling, for a router the clear recommendation is react router, and for a flux implementation the clear recommendation is Redux. It feels like there's a well defin…

Having used TypeScript and also picked up recent projects where it is not being used, TS is definitely the way to go.

The issue is that TS 1.8 doesn't support async/await in the browser until v2.0, but a ts -> babel transpile does the job nicely.

Re: Angular 2 Final Released

#193
post #189

I use Angular 2 in production since November 19, 2015 (alpha.46). Currently I've built 3 web apps (40, 60 and 20 components each), 3 mobile apps (with Ionic 2) and my employer have plans for more apps. Breaking changes during alpha stage were expected, so I didn't have issues with it. Most positive things I want to highlight: 1. Components are encapsulated and truly reusable (and without dependencies hell). 2. You do…

I haven't used Angular yet. From it's description it seems to be geared for making single page apps. Or a app with a few pages because it's good a binding data to an interface. Is this accurate? What is a good use case for Angular?

I think you've basically got it.

Re: Angular 2 Final Released

#194
Rob Eisenberg and his nimble team beat Angular 2 to the punch all the way back in July when Aurelia final was released. Before considering Angular, considering checking out http://aurelia.io - easier to learn, no third party dependencies and great support. I applaud the Angular team for sticking it out, but I am afraid they released far too late to compete with the likes of React, Vue and so on.

Re: Angular 2 Final Released

#195
post #77

I use Angular 2 in production since November 19, 2015 (alpha.46). Currently I've built 3 web apps (40, 60 and 20 components each), 3 mobile apps (with Ionic 2) and my employer have plans for more apps. Breaking changes during alpha stage were expected, so I didn't have issues with it. Most positive things I want to highlight: 1. Components are encapsulated and truly reusable (and without dependencies hell). 2. You do…

Any chance you can do a quick cons review too? Specifically comparing to the weakness of Angular 1 like bloated complexities, issue with custom directives or scope life-cycle.

Cons:

1. Typescript. If your team isn't familiar with it it's not trivial to get everyone on board. The up-front cost can absolutely be worth it in the long run, but there's some friction in the day-to-day work with managing type definition files and looking up esoteric lint-errors from the Typescript compiler.

2. RXJS. Canonical NG2 should use Observables, and rxjs is not a trivial library to learn the ins and outs of. Add to that that there's no clean way of doing testing with Observables at the moment (integrating with the rxjs testing schedulers is very finicky). This is doubly true if you're using ngrx (which you probably should).

3. Template language. I'm one of those who don't think it's a very good idea to bring a new DSL into html. I'd much rather do it the React-way of bringing HTML into JS instead of relying on a very complex compiler to do magic behind the scenes. This becomes a bit better with the template pre-compilation, but it's still new syntax that you need to learn and keep in mind. Some of which is not intuitive nor well documented (i.e. how pipes and parentheses work together).

4. It feels unfinished. This is to be expected since it's just on it's initial release, but the sharp edges do show up quite a lot. For example we very often have to do manual subscription and unsubscription of Observables in Components. This feeling also goes for quite a few of the community addons, such as the browser-extension. While I absolutely applaud their efforts, it's far from reaching the quality of e.g. the Ember-Inspector.

5. Sub-par debugging experience. When you get any errors there's a mile long stack trace filled with rxjs and zone.js garble, making it very hard to actually figure out what's going on. When there actually are custom error-messages they are not very informative, with you having to fundamentally grok how parts of NG2 works to even come close to understanding why it's not working (getting this a lot with the change detection).

6. Lack of documentation. I tried to stay very far away from Angular 1 since I found its documentation to be very low quality (probably a symptom of Angular 1 being poorly engineered as well). The NG2 docs are definitely better, but I feel like my mental model for reasoning about how things work was still very weak when I had finished going through the docs. There's some really huge gaps in there (testing) and a lot of the really complicated stuff that you will stumble over is only really documented in semi-old blog posts.

Re: Angular 2 Final Released

#196
post #48

I evaluated React and Angular 2 several months ago and picked React. Some of the issues I found in Angular 2: The HTML template in Angular 2 is stored in a string. This has several disadvantages: 1. Editors can't do syntax coloring. 2. Editors can't do auto-indenting. 3. Editors can't offer "intellisense" suggestions. 4. Editors can't match tags. You embed variables in this template string like this: ' {{hero.name}}…

>The HTML template in Angular 2 is stored in a string. This has several disadvantages

This is patently false. Just use "templateUrl" instead of "template". This allows you to specify a file instead.

This is the way I always did it in angular 1 as well. I don't really understand why style guides & general practice recommend embedding html in the javascript though. It's horrible.

Re: Angular 2 Final Released

#197
post #135

It is interesting how people are debating here, angular this, react that... Yet there is Polymer that just works, has a great ecosystem, awesome material design support and is a breeze to work with (+ its fast too). Right now there was 2.0 announcement and new version really supports easy migration path unlike Angular 2.x.

Does anybody actually use Polymer? Frontend jobs are mostly either Angular or React related.

You can see some projects at:

https://github.com/abdonrd/PolymerProjects

Re: Angular 2 Final Released

#198
post #164

Earlier quoted context omitted.

True story. But how did you get rid of the implicit anys when using JSX? I used this compiler flag that forbids them and suddnendly nothing worked anymore. It seemed that almost everything returned any per default.

That compiler flag is wonderful, and so is the newer 'strictNullChecks' I use these typings: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast... Then create my components like this: interface Props { } interface State { } class MyComponent extends React.Component { } and everything is typed correctly (beside setState which is impossible to type exactly as of today)

How would you do something like this with stateless components? (Where the component is just a function that takes props)

Re: Angular 2 Final Released

#199
post #13

Earlier quoted context omitted.

I'm currently in the same boat. Both are similar in that they are component-oriented. There are two important factors in my mind. 1. The ecosystem (as you mentioned). React has a clear head start here, but I expect Angular2 to make some gains over time. 2. Angular2 gives you a full framework, and as they say now, a whole platform. React is smaller and you rely on a bunch of other packages to get all the extra feature…

As someone who has never used Angular but is interested in Angular 2, can you give some examples of the framework-y things it provides that React doesn't? Redux is really the only thing I find necessary for what I've developed so far, and I'm sure Angular has it's equivalent, but what else does it have?

It gives the ability to do validation with form components, using a nice XHR abstraction, and a router - all optional. It also provides a robust DI framework and set of testing tools.

Re: Angular 2 Final Released

#200
post #192

Earlier quoted context omitted.

I'm just writing a first React app, and read beforehand that it was going to be difficult to choose which libraries to use, and to get them to work together, but I haven't found that to be much of an issue in practice. create-react-app set up all the build tooling, for a router the clear recommendation is react router, and for a flux implementation the clear recommendation is Redux. It feels like there's a well defin…

Having used TypeScript and also picked up recent projects where it is not being used, TS is definitely the way to go. The issue is that TS 1.8 doesn't support async/await in the browser until v2.0, but a ts -> babel transpile does the job nicely.

TS 2.0.2 is stable enough for usage I've found, had no issues at all using it so far.
Post reply on HN