News for hackers. Stuff that matters.
Re:Angular 2 Final Released by gkoberger on Wednesday September 14, 2016 @11:33PM (#12503203)
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.

Re:Angular 2 Final Released by kayoone on Thursday September 15, 2016 @12:05AM (#12503330)
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 by awjr on Thursday September 15, 2016 @04:15AM (#12504283)
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...

Re:Angular 2 Final Released by Brakenshire on Thursday September 15, 2016 @06:19AM (#12504732)
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 defined path for beginners. Over time you'll have to figure out how everything works, as is always the case, but you can learn more as and when it's necessary.

The bumps were more whether to use ES5 or ES6 (but then I found an official position in favour of ES6), and whether or not you need to use flux (although that was really just learning how flux worked, which wasn't wasted time).

The only uncertainty I have now is whether TypeScript will be necessary/useful in future, and if so how to integrate it.

Re:Angular 2 Final Released by waffleau on Thursday September 15, 2016 @07:34AM (#12505117)
The sanctioned way forward for React is Flow. It's not as comprehensive as TypeScript, but there's no compilation required - Flow annotations just get stripped out. As of a couple of weeks ago it is part of create-react-app.

https://flowtype.org

Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @12:23PM (#12507445)
Too bad flow doesn't work as well as typescript in practice. It has way more bugs, is not as tested.

It was very promising at first but typescript now has caught up with Flow best design decision: noImplicitAny, strictNullChecks.

Also, check on the "try typescript" website: typescript's JS output is almost left untouched. it's effectively a replacement for babel, if you only care for ES2015 stuff, and not some of the more recent stage 0 / stage 1 stuff.

Re:Angular 2 Final Released by devdoomari on Saturday September 17, 2016 @06:34AM (#12519948)
this. tried flow, but it's too 'smart' for my iMac to handle. Flow reads all JS files without problems - which killed my iMac after using 6>gb ram. a partial solution was to manually set ignore on some node_modules packages. but still, really slow experience with atom/subl/etc.

Compared to this, typescript is actually dumb enough to require ts definition files to actually parse non-ts (js) files.

Re:Angular 2 Final Released by awjr on Thursday September 15, 2016 @06:39AM (#12504810)
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 by Bahamut on Thursday September 15, 2016 @07:15AM (#12505011)
TS 2.0.2 is stable enough for usage I've found, had no issues at all using it so far.
Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @09:38AM (#12505989)
Yes, typescript betas/rc's are more stable than many products out there :p
Re:Angular 2 Final Released by gbog on Thursday September 15, 2016 @10:25AM (#12506388)
Microsoft stuff not allowed in my stack...
Re:Angular 2 Final Released by hackerboos on Thursday September 15, 2016 @11:19AM (#12506884)
Why? It's Apache 2.0 licensed...
Re:Angular 2 Final Released by gbog on Thursday September 15, 2016 @09:09PM (#12511225)
People seem to have forgotten that MicroSoft was a gigantic threat to our industry, and still is. It owns 98% PCs world wide. What would we think if 98% of gaz stations worldwide where belonging to one company? That would be dangerous, right? Same with MS except it's worse, because PCs are eveyrwhere controlling everything. It's Big Brother in real life. Just imagine one moment how many critical decisions having world wide impact on the life of billions of people are done using Excel? What if Excel was remote controlled?

So, no, sorry, I don't eat that stuff. Bill Gates has built the most dangerous edifice and no amount of charity will save him from the Hell of digital beings.

Re:Angular 2 Final Released by olingern on Monday September 19, 2016 @06:10PM (#12535189)
This is garbage.
Re:Angular 2 Final Released by gbog on Thursday September 15, 2016 @10:20AM (#12506349)
I replaced react-router with route-recognizer. The later is a simple tool your code is using, has proper documentation and stability, and do not get in the way of automated tests with jest. But react-router changed too much (i.e. removed named routes), has a lot of dependencies (browserhistory, etc), has very poor documentation, and did not allow me to do automated testing at the levels I wanted to. Moreover, it is a "framework": you're code lives inside of it, breathes through it, and that's something I dislike greatly (for such a moderate usefulness).
Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @12:28PM (#12507488)
Agreed, react-router developers try too much to change and add new features to their baby. it has become a bit of a monster. 46KB for a minified router framework...
Re:Angular 2 Final Released by Roboprog on Thursday September 15, 2016 @11:57AM (#12507201)
Good thing you don't have clients demanding IE compatibility. Bye bye ES6 :-(
Re:Angular 2 Final Released by matmo on Thursday September 15, 2016 @01:49PM (#12508217)
Doesn't babel (ES6 --> ES5) solve this issue or is there more to it?
Re:Angular 2 Final Released by Roboprog on Friday September 16, 2016 @12:02PM (#12514937)
You're right. But I've avoided bringing transpiling or polyfill stuff into our big project at work. I'm the only dev at work who really like JS at all, anyway, so I'm trying to keep it simple for the Java-only crowd.
Re:Angular 2 Final Released by sotojuan on Thursday September 15, 2016 @10:48AM (#12506593)
CRA isn't opinionated aside from the config and testing (Jest). It has no router, no Redux, etc.

It was made for demos, proof of concepts, and beginners (at the beginning, maybe not anymore). I don't know how Angular CLI works, but if it works like Ember's, then there's no comparison. Ember CLI generates models, controllers, etc. any kind of thing and it enforces a file and directory structure that makes all Ember apps look the same.

Re:Angular 2 Final Released by plexicle on Thursday September 15, 2016 @10:39AM (#12506506)
Don't have a dog in the fight-- I'm using both React and Angular2 in production. I just wanted to add that create-react-app (which was built by a few guys over a weekend or something like that?) I found to be IMMENSELY more useful than angular-cli.

I know a lot of work has been put in to angular-cli and it's been through a few iterations at this point, but I almost wish they would scrap the whole thing and fork create-react-app.

Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @04:42AM (#12504391)
You can totally use typescript with React, in fact it's a game changer. It's actually way more beneficial than with angular, as you have properly typed components all the way down. No crappy string templates that are not checked by typescript.
Re:Angular 2 Final Released by k__ on Thursday September 15, 2016 @04:53AM (#12504435)
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.

Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @05:11AM (#12504503)
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<Props, State> {

}

and everything is typed correctly (beside setState which is impossible to type exactly as of today)

Re:Angular 2 Final Released by woah on Thursday September 15, 2016 @07:14AM (#12505004)
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 by cwmoo740 on Thursday September 15, 2016 @09:27AM (#12505916)
interface IMyComponentProps { x: number; }

function MyComponent(props: IMyComponentProps): JSX.Element { return <p>{props.x}</p>; }

Re:Angular 2 Final Released by k__ on Thursday September 15, 2016 @05:58AM (#12504672)
Maybe it was the type definition I used...
Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @08:07AM (#12505364)
Stateless component:

  interface Props {
    bla: string
    ble: number
  }

  export default function MyComponent({ bla, ble }: Props) {

  }
Re:Angular 2 Final Released by danmaz74 on Thursday September 15, 2016 @03:57AM (#12504214)
Regarding the "Flux" frameworks, that's not a problem anymore - basically Redux (which improves on some of Flux's faults) has won. Its developer was hired by Facebook, so I guess it's kind of officially sanctioned now.
Re:Angular 2 Final Released by subsection1h on Thursday September 15, 2016 @04:28AM (#12504344)
Has everyone who switched from Redux to MobX been informed that Redux won and they should switch back?
Re:Angular 2 Final Released by k__ on Thursday September 15, 2016 @04:56AM (#12504446)
I didn't understand this. Isn't MobX the "classical" way of databinding everybody frowned upon for years? And now that React finally eased that pain with Flux and then Redux, they bring it back?
Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @05:14AM (#12504513)
I don't think that many people switched to MobX to be honest. It's very similar to knockout observable and while it works, I don't think I would use that approach again. I suspect people like the familiar OO syntax of MobX. I can't think of advantages it has over plain old streams (most.js, flyd.js)
Re:Angular 2 Final Released by Kiro on Thursday September 15, 2016 @05:37AM (#12504598)
Who has switched? Do you have any example?
Re:Angular 2 Final Released by simonrobb on Thursday September 15, 2016 @10:47AM (#12506589)
I've just finished my first major redux project and found it incredibly slow to develop with. Write an action type constant/action creator/dispatch/reducer/mapStateToProps just to show an element in response to a mouse click? I found myself cutting corners on the UI because the amount of code I'd have to write makes it seem like a huge task.

I'll be evaluating mobx for my next project, definitely, along with Relay. If I can maintain the same view-as-a-function-of-state approach of redux while writing less code, I'm sold.

Re:Angular 2 Final Released by Kiro on Friday September 16, 2016 @04:11AM (#12512587)
That's interesting. I've only used redux for one project and you may be right. It is tedious to all those things for every little action.
Re:Angular 2 Final Released by danmaz74 on Thursday September 15, 2016 @08:08AM (#12505378)
I'll admit that I hadn't heard so much about MobX yet. Will re-evaluate when I have time.
Re:Angular 2 Final Released by davedx on Thursday September 15, 2016 @11:50AM (#12507142)
Yup, this is a major strength of the front end frameworks. It can't be understated in my opinion.

I work daily on a large Angular app and a growing React app, and my React app, while being more pleasant to work with, is also much harder to keep standardised and clean. I'm also already experiencing perf issues because of not using immutableJS, which is quite annoying...

Re:Angular 2 Final Released by asher_ on Wednesday September 14, 2016 @11:53PM (#12503285)
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 features you need. If you want a full solution, Angular2 gives you that.

This can be argued as a good thing or a bad thing. More flexibility with React, but also more things you need to figure out and make a decision about. With Angular2, once you buy in, you don't need to make all of those decisions.

In my particular circumstance, which is to migrate an Angular1 app to a newer framework over time (mainly for the server side rendering features), Angular2 provides a clearer path and offers some nifty features like component styles that allow a similar migration with CSS.

Re:Angular 2 Final Released by gldalmaso on Thursday September 15, 2016 @08:39AM (#12505565)
>> Angular2 gives you a full framework, and as they say now, a whole platform.

So did Angular 1, and then they threw it under a bus. Now developers have to either refactor for a whole new framework or get stuck with a legacy one.

Javascript ecosystem is becoming so hostile a project deprecates itself in favor of a clean rewrite and the migration path is an afterthought.

Will think twice before adopting google frameworks and tools.

Javascript ecosystem is in dire need of stability and trust.

Re:Angular 2 Final Released by popmystack on Thursday September 15, 2016 @09:19AM (#12505838)
>and then they threw it under a bus.

They didn't just do this "because." There were sound technical reasons to do so. Angular made the correct decision, in my opinion, and decided to cut its losses immediately and right the wrongs within the framework.

Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @10:36AM (#12506492)
Well... I would argue that angular 2 is not even better than angular 1 so it will probably happen again :p It's more performant, but that's about it. It's insane, java/spring like complex for no reason.
Re:Angular 2 Final Released by popmystack on Thursday September 15, 2016 @11:46AM (#12507108)
Really? So mobile support, change detection revamp, TypeScript, the removal of $scope, and all the routing changes are all just "meh" to you?
Re:Angular 2 Final Released by Roboprog on Thursday September 15, 2016 @12:01PM (#12507239)
Wellllllll... I does make me want to learn React & React Mobile if I have to largely start over, anyway.

Not saying ng-2 is not an improvement, just that it's a big change to take in.

Re:Angular 2 Final Released by BigJono on Thursday September 15, 2016 @04:41AM (#12504386)
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?
Re:Angular 2 Final Released by Bahamut on Thursday September 15, 2016 @07:14AM (#12505006)
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 by jasim on Thursday September 15, 2016 @12:19AM (#12503377)
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 by mstijak on Thursday September 15, 2016 @02:55AM (#12503972)
Have you seen yesterday's post about Cx? I'm curious what you would have to say about it.

Cx adds declarative data-binding, controllers and router on top of React and includes composable widgets and charts. It looks for a sweet spot between development speed and freedom to do whatever you want. Here's a quick example https://cx.codaxy.com/fiddle/?f=42vDn4I1.

Disclaimer: I'm the author of Cx.

Re:Angular 2 Final Released by jasim on Thursday September 15, 2016 @04:07AM (#12504260)
First impressions: looks like Angular's two-way data binding (using custom attributes in the template itself) added to React. This should make it possible to write complex views quite fast - without writing much code, and yet we don't lose out on the component-based composition of Javascript code offered by React.

What I need time to get around to is the concept of controllers and how it works when we want to compose things together. For example, how to write a multi-select widget that exposes a clear API to the rest of the world (onChange), and encapsulates all other details within. Cx does deserve a deeper look, and I'll definitely give it a whirl some time. Also kudos for the extensive documentation you've so far written!

Re:Angular 2 Final Released by mstijak on Thursday September 15, 2016 @04:52AM (#12504432)
Thanks.

Here's an example of a complex lookup field in practice. https://github.com/codaxy/cx-starter-kit/blob/master/app/rou...

It's perfectly fine to add multiple bindings between lookup options and field's data. That works for multivalue fields too.

If you have any other questions I'm happy to answer in this thread https://news.ycombinator.com/item?id=12495728

Re:Angular 2 Final Released by akst on Thursday September 15, 2016 @10:55AM (#12506660)
Apologises if I'm miss reading this

> Angular and Ember allows state and logic inside HTML.

State updates do not occur in Ember templates. Templates specify the follow data from one component to another, as well as callbacks which are names of actions defined in a javascript portion of a component, or a parent component.

But it does not allow you to specify how state is updated within the template. In terms of Logic, there's just if statements & loops which is pretty conservative imo.

edit: rephrasing words

Re:Angular 2 Final Released by jasim on Thursday September 15, 2016 @11:18AM (#12506876)
That is exactly what I meant, sorry for not being clear. State mutation definitely happen only in code everywhere, and not in templates (if we exclude two-way binding).

But by logic I meant all sorts of control structures, which though looks light-weight at first, needs a large number of language elements to function. To name a few: variables, expressions (which in turn need operator precedence rules), scoping, and even composition if we count partials/templates with it. Loops on the other hand requires not just simple array iteration syntax, but also over hashes, and it also needs other constructs like filtering (`todo in todos | filter:search`).

This is my biggest complaint with adding logic to text templates; behind the apparent simplicity there is always an entire language.

Re:Angular 2 Final Released by akst on Thursday September 15, 2016 @01:17PM (#12507936)
> That is exactly what I meant, sorry for not being clear.

All good, I'm probably tired (Australian time).

Maybe it's my inherit bias as an Ember user, but I'd argue Ember's templating language is alot simpler than you're suggesting

> But by logic I meant all sorts of control structures, which though looks light-weight at first, needs a large number of language elements to function. To name a few: variables, expressions (which in turn need operator precedence rules), scoping, and even composition if we count partials/templates with it.

Admittedly partials are a little weird, while I don't see them very often, it's still a fair point, however Ember templates don't deal with operator precedence as it doesn't have binary operators (entirely polish notation).

> Loops on the other hand requires not just simple array iteration syntax

Iteration doesn't have a blessed syntax, but instead utilises syntax that can be utilised by other components, and a better way to think of it is, the block inside the component is actually a function being passed to the component, which the component calls with every item of the collection.

> but also over hashes, and it also needs other constructs like filtering (`todo in todos | filter:search`)

It doesn't have pipes/filters, as that's easily expressed as a computed property in the js portion of a component. And I personally think scoping is pretty predictable imo.

Maybe you're just making a general remark about templates in general & i've read too far into it, then fair enough but in the case of Ember some of those don't apply, imo.

> behind the apparent simplicity there is always an entire language

Technically this is true, but I'm not sure why this matters, especially if it's trivial to learn? Because flip side of the argument, technically JSX is a different language to JS & HTML with even more complex semantics than a templating language because it carries the semantics of JS on top of it. You could make the same argument in favour of css over SASS/LESS, so I don't really see this as a big deal

Re:Angular 2 Final Released by jasim on Thursday September 15, 2016 @01:36PM (#12508113)
I haven't worked with Ember's templating syntax, so don't have any thoughts to offer there. I was however bitten by Angular v1's templating, on which my comments were based.

SASS and LESS both add language semantics over CSS and suffer from the same problem. So does for example Jekyll's templating language. But in case of CSS, the language additions are a practical necessity - it lacks even basic abstractions, which the pre-processors provide.

So there - trade-offs.

I've written in more detail about this topic at http://www.jasimabasheer.com/posts/evolution-of-view-templat..., if you are interested.

Re:Angular 2 Final Released by akst on Thursday September 15, 2016 @02:22PM (#12508496)
Sure, I'll give it a read.
Re:Angular 2 Final Released by jasonkester on Thursday September 15, 2016 @03:06AM (#12504010)
I recently started a new front-end-heavy project and ended up just using Angular 1 instead of React. The decider for me was the amount of tooling that React needs you to have in place just to get up and running.

React expects you to do your development on some flavor of Unix, and really doesn't have a sane plan for Windows, so you lose VS.NET and its huge productivity gains. And it needs tools upon tools upon tools to set up, whateverify, transpile and pack the files you write into something that can display in a browser. Again, this all seems to want to run from a Unix command line.

I want to edit some HTML and Javascript, then reload the browser and see my changes. Angular isn't perfect, but at least it lets me do my thing without adding a bunch of extra hoops.

Re:Angular 2 Final Released by lacker on Thursday September 15, 2016 @03:44AM (#12504145)
And it needs tools upon tools upon tools to set up, whateverify, transpile and pack the files you write into something that can display in a browser.

I think this was true six months ago but now there is create-react-app. You might want to try it out - you won't need to whateverify your code, you just need that one tool. Also it works on Windows.

https://github.com/facebookincubator/create-react-app

I want to edit some HTML and Javascript, then reload the browser and see my changes.

With create-react-app the browser will know you've made a change, and reload for you ;-)

Re:Angular 2 Final Released by jasonkester on Thursday September 15, 2016 @03:49AM (#12504181)
npm install -g create-react-app

The fun thing watching the new world of Javascript is that overtooling is so built in to everything that nobody even realizes how many tools they're using. You can't even install this thing until you have the standard pile of javascript tooling in place. And it never occurred to them to even mention how to get said pile set up.

Once set up, this still uses all the same stuff. It just removes a few steps to produce the Big Red Button you press to run it all.

Re:Angular 2 Final Released by BigJono on Thursday September 15, 2016 @04:35AM (#12504370)
This is the problem I have with all these "easy" setups and boilerplate projects. It doesn't matter how you set up your project, unless you do it wrong, it all comes down to a one liner in the end. All these things do is hide the complexity from you with the goal of being able to "get up and running quick", which I find fairly pointless for projects that are of a significant enough size that you're considering using React or Angular for them. You're much better off learning all the tools and understanding how your project works.

But then again, the thing about the overtooling is: I can't find anything in my React stack that is unnecessary or can be removed. And really, all it is is React, Redux and Webpack. I think the complexity of front-end Javascript development is blown a little bit out of proportion.

Re:Angular 2 Final Released by dismantlethesun on Saturday September 17, 2016 @01:50AM (#12519339)
Ah well rather than being uncessary, theres' alternatives for all of those options.

React could be replaced with Preact or Inferno.

Redux could be replaced with MobX or RxJS.

Webpack could be replaced with JSPM.

Re:Angular 2 Final Released by JustSomeNobody on Thursday September 15, 2016 @08:25AM (#12505476)
Exactly. It's "Oh, you don't like all the tooling, let's hide it all so when something breaks you have no idea where to look! HA! Isn't this FUN!"

No thanks.

Re:Angular 2 Final Released by mcintyre1994 on Thursday September 15, 2016 @04:26AM (#12504328)
> With create-react-app the browser will know you've made a change, and reload for you ;-)

Isn't that hot reloading of components which they say is unsupported?

Re:Angular 2 Final Released by jefffan241 on Thursday September 15, 2016 @05:53AM (#12504649)
It actually refreshes the whole page it isn't hot reloading. It's more like live reloading (who page instead of pieces of the page).
Re:Angular 2 Final Released by pferdone on Thursday September 15, 2016 @04:57AM (#12504451)
I can not share your experience at all. We are using React with Typescript for our projects at work and we have all common systems present (Linux, Windows, Mac).

Our projects compile from Typescript to ES6 and then ES6 to ES5 through babel. All of that takes place in webpack, and it was pretty easy to setup. We also all use Visual Studio Code and it's a joy to work with.

If you use something like hjs-webpack it gives you (hot-)reloading for code changes out of the box.

Re:Angular 2 Final Released by mattmanser on Thursday September 15, 2016 @05:06AM (#12504491)
Visual Studio has task runner explorer now as well, it's easy to setup command line tools to run automatically, either on project open or on build.

I despair these days at the ridiculous number of command line tools you need to run, but once you've completely wasted 2 or 3 days of your life on these pointless things, cut and pasting command lines from setup instructions that give no indication what any of the flags actually mean, you can forget about them.

There were days when you just had to run an installer and then you were good to go. Or just get the latest version of the tools (and by tools I mean actual tools with a GUI and everything, gasp!) That's obviously really untrendy now.

But yeah, you can set it all up in VS to deal with the insanity for you. Good thing too, as the ASP.Net team have been drinking heavily from the command line insanity kool-aid.

Re:Angular 2 Final Released by woah on Thursday September 15, 2016 @07:19AM (#12505039)
Do you really want to point and click around on everything all the time? Maybe read the documentation on what various flags mean when you decide to use something.
Re:Angular 2 Final Released by mattmanser on Thursday September 15, 2016 @09:50AM (#12506073)
Yes, the mouse + GUI is a lot more usable to me than typing in a CLI. The command line is from when we had terminals.

And worse still, yes, that's the case for most people. Most people prefer using mice + GUIs. Why are we going back in time? Why can't we have tools that work as both GUIs and CLIs?

CLIs are great for automation (and keyboard obsessed users).

GUIs are great for discoverability and making it obvious to users what the 'normal' usage is.

It's absolute madness to go back to the days of CLIs.

Re:Angular 2 Final Released by cygned on Thursday September 15, 2016 @03:02PM (#12508838)
I'd disagree here. All the most productive developers I know make heavy usage of the CLI, and some of them, including me, are even developing in it with tools like vim or Emacs.
Re:Angular 2 Final Released by mattmanser on Thursday September 15, 2016 @07:21PM (#12510679)
Self-selecting a bit there... Productive developer!

Have you considered that part of the problem is the stack you use causes other people to be unproductive because it's not clear what all the tools you're using are doing?

Re:Angular 2 Final Released by majc2 on Thursday September 15, 2016 @04:53AM (#12504433)
> React expects you to do your development on some flavor of Unix, and really doesn't have a sane plan for Windows, so you lose VS.NET and its huge productivity gains.

I've done both React projects with Python and C# apis. React is perfectly usable in VS.NET - are you aware of the Task Runner Explorer - https://blogs.msdn.microsoft.com/webdev/2016/01/06/task-runn... - hooks whatever you want into the build cycle, watches etc - once I discovered that, everything just clicked into place.

Re:Angular 2 Final Released by kentor on Thursday September 15, 2016 @11:15AM (#12506840)
Manually reload the page? No thanks, way too slow. Using React hot loader and can't go back.
Re:Angular 2 Final Released by flukus on Thursday September 15, 2016 @03:13AM (#12504031)
This mirrors my experience with react native. Not only did you have the react tools, but all the android tools. The abstraction leaked for me at the hello world stage where one dependency changed but I had no idea what our where without learning the entire stack.
Re:Angular 2 Final Released by edoceo on Thursday September 15, 2016 @03:19AM (#12504041)
See RiotJS
Re:Angular 2 Final Released by ckarthik17 on Thursday September 15, 2016 @12:23AM (#12503401)
For big enterprise projects where there are many average developers, a full framework like Ember.js or Angular2 is practically easier to maintain.
Re:Angular 2 Final Released by szines on Thursday September 15, 2016 @07:39AM (#12505157)
Especially Ember. Probably Ember is the best choice nowadays for serious project. Great documentation and very matured.
Re:Angular 2 Final Released by pacoverdi on Thursday September 15, 2016 @08:05AM (#12505349)
I lost so much time with Angular 1. I don't care how much v2 is better than v1, I'm not touching it with a ten foot pole (disclaimer: switched to React, not looking back).
Re:Angular 2 Final Released by 6DM on Thursday September 15, 2016 @08:55AM (#12505666)
I'm really feeling the pain right now. Convinced previous company react was better. Even built my own app in React, now I'm at a new place that is using Angular 1.5. My god, it's so painful trying to get everything working correctly with jquery plugins. The blessed route often doesn't work, even though technically it should. I'm also getting performance issues for really simple scenarios...
Re:Angular 2 Final Released by Roboprog on Thursday September 15, 2016 @12:04PM (#12507270)
The only thing in ng-1 that really bit me, speed wise, was long select/option lists. I wrote a bit to load them using jQuery instead of ng-options and now I'm good.
Re:Angular 2 Final Released by boubiyeah on Thursday September 15, 2016 @10:38AM (#12506496)
The thing is, angular 2 is not better. Not api wise. It's just more performant, which is cool and all, but react has a much better value proposition.
Re:Angular 2 Final Released by dimgl on Thursday September 15, 2016 @01:33AM (#12503693)
Why not choose Vue.js? It's extremely simple, fast, easy to get started with, and very similar to Angular.
Re:Angular 2 Final Released by jessegavin on Thursday September 15, 2016 @07:49AM (#12505232)
I have used knockout, angular, react for a while. When I used vue.js the first time, I smiled. It made me happy.
Re:Angular 2 Final Released by ausjke on Thursday September 15, 2016 @11:15AM (#12506854)
I like vue.js, the only and biggest concern is that it is a single developer project, I'm deciding between react and ng2 now because of that concern, leaning towards react right now.
Re:Angular 2 Final Released by rk06 on Thursday September 15, 2016 @12:38PM (#12507595)
Evan has added a dozen collaborators to Vue team. so it is no longer a single developer project.

Yes, the majority of code is still written by Evan, due to speed required. but we know that vue is heading in right direction.

Re:Angular 2 Final Released by WA on Thursday September 15, 2016 @05:53AM (#12504647)
I like Vue.js, but there are no good UI frameworks such as Ionic that work with Vue for mobile apps.
Re:Angular 2 Final Released by kim0 on Thursday September 15, 2016 @07:17AM (#12505027)
Re:Angular 2 Final Released by philippz on Thursday September 15, 2016 @04:42AM (#12504394)
For economical reasons. We decided between ng2, React and Vue.JS: https://docs.google.com/spreadsheets/d/1ULB2GjA3ytXAN_Sn-fEy...

React would mean to rewrite your whole application as it has a totally different basic concept. Following the ng2 migration path you're able to migrate slowly.

Re:Angular 2 Final Released by shados on Thursday September 15, 2016 @02:09PM (#12508393)
at my last job we did a gradual migration from Angular 1 to React. Its similar to the path to Angular 2 really. React and Angular can live side by side... All we did was build an Angular directive that can render a react component in a subtree (that's easy), and a React component that could render an Angular directive (that's a little harder, but not that bad).

With that, we could put a React component anywhere in our Angular app, and reuse Angular directives inside of React until we got around to rewriting them.

That ended up quite smooth.

Re:Angular 2 Final Released by tomasduda on Thursday September 15, 2016 @04:45PM (#12509680)
Would you mind sharing the code for this?
Re:Angular 2 Final Released by shados on Friday September 16, 2016 @10:14AM (#12514117)
I wanted to open source it at the time...then my employer had layoffs :)

The "React component inside of Angular directive" is fairly trivial and there's a million examples on the net. Just make a directive that calls ReactDOM.render on the element in the link function.

Angular inside of a React component is harder to google for, namely because there's so much misinformation saying its impossible.

It ended up being a variation of the discussion here: https://github.com/ngReact/ngReact/issues/80

(The code in the example isn't quite there...and its been a very long time since I did it, so I don't quite remember the tweaks I had to make).

Re:Angular 2 Final Released by elmigranto on Thursday September 15, 2016 @09:11AM (#12505773)
> React would mean to rewrite your whole application

I don't see what is a problem to just drop in React into `<script>` tag and use for single part of the page, gradually refactoring stuff.

Re:Angular 2 Final Released by philippz on Friday September 16, 2016 @05:14AM (#12512769)
That would mean to live with a hybrid solution, more overhead and a bigger footprint. We currently deploy our JS base to web, Android and iOS (Cordova/Phonegap). It is and will remain one code base to be flexible and fast until we get "product/market fit" and until we have KPIs where we want them. This is cost effective but comes with the slowness of web-engine rendered apps. Therefore performance is big factor and we're optimizing for that. By switching to ng2 we have have a cost-effective and performant compromise.
Re:Angular 2 Final Released by Illniyar on Thursday September 15, 2016 @02:17AM (#12503849)
At the moment I also moved to react, but there are some obvious advantages in angular 2:

1. as others mentioned its a fuller framework, mostly akin to using react with redux (or flux etc...) and a di framework. This also means that angular 2 third party components are probably easier to integrate.

2. Reactive Expressions, which angular2 uses in many places, is a joy to work with (though they might become maintenance hell later on I think). You can use RxJs with React of course, but it's easier when your framework is based on it

3. It uses string templates - which means that some things such as dynamic templates and per user customization of html would probably be much easier to do then in React.

4. It has Ionic - which is much much faster to develop for mobile with then react-native (though obviously there are important differences). It's unlikely that an Ionic like framework for react will gain traction with react-native to compete with.

Re:Angular 2 Final Released by indexerror on Thursday September 15, 2016 @02:27AM (#12503878)
> It uses string templates - which means that some things such as dynamic templates and per user customization of html would probably be much easier to do then in React.

The key with React is that you manipulate JS instead of HTML. In my experience, using JS to manipulate elements turns out to be easier and a much better experience than the conventional way of using templates.

Re:Angular 2 Final Released by diminish on Thursday September 15, 2016 @04:36AM (#12504375)
Why JS declarative manipulation is a much better experience than using templates?
Re:Angular 2 Final Released by LgWoodenBadger on Thursday September 15, 2016 @08:59AM (#12505698)
Because you have the full power of JS available to do whatever you want, however you want, to generate HTML. With a templating engine, you only have whatever the templating engine provides.
Re:Angular 2 Final Released by Life_exe on Friday September 16, 2016 @08:34AM (#12513542)
React would let you use JS-powered templates. Angular would let your use ANY (static html, JS generated, or dynamic/server generated), because its pluggable.

For me, the power offered by Razor(cshtml) is too much to abondon.

Re:Angular 2 Final Released by Pfhreak on Wednesday September 14, 2016 @11:40PM (#12503230)
As someone who uses React currently, this would be useful to me too.
Re:Angular 2 Final Released by irrational on Wednesday September 14, 2016 @11:49PM (#12503267)
Or Vue.js, or Inferno, or...
Re:Angular 2 Final Released by sjellis on Thursday September 15, 2016 @02:28AM (#12503886)
Yeah, we have Angular 1 code in production, and I would like us to get off this train. I'm going to be evaluating Vue.js and Aurelia, and will probably push for Aurelia.
Re:Angular 2 Final Released by stephenhuey on Friday September 16, 2016 @09:23AM (#12513773)
We were in the same boat back in January, and I looked at Vue and many others, but Aurelia won me over even though it was still in beta.
Re:Angular 2 Final Released by 0xfaded on Thursday September 15, 2016 @01:12AM (#12503601)
For anyone wanting to try react in a side project, scalajs has comprehensive react compatibility and it's just awesome.

Only downside is trying to hire Scala frontend devs.

Re:Angular 2 Final Released by estefan on Thursday September 15, 2016 @04:27AM (#12504335)
Yeah I've been looking at this recently. I like autowire's ability to create typesafe APIs shared across the client and server. Very promising, but not simple to set up...

http://www.lihaoyi.com/hands-on-scala-js/#Autowire

Re:Angular 2 Final Released by premium-concern on Thursday September 15, 2016 @12:47PM (#12507664)
You don't need Autowite for that. That's pretty much basic functionality of Scala.js.
Re:Angular 2 Final Released by estefan on Thursday September 15, 2016 @01:07PM (#12507851)
Really? From reading that guide I thought that Autowire made it easier by automatically doing the serialisation/deserialisation. How does stock scala.js do that?
Re:Angular 2 Final Released by cutler on Thursday September 15, 2016 @04:50AM (#12504414)
Extra downside is code bloat. Scala.js on its own just maybe but combined with another major framework - forget it.
Re:Angular 2 Final Released by premium-concern on Thursday September 15, 2016 @12:48PM (#12507680)
The amount of code bloat is offset by optimizing a medium-sized picture.
Re:Angular 2 Final Released by kinkdr on Thursday September 15, 2016 @05:39AM (#12504604)
Maybe because Angular material components are much better than material-ui?
Re:Angular 2 Final Released by Rezo on Thursday September 15, 2016 @09:00AM (#12505705)
I've been very happy with the material-ui components for React. They cover every component I need, and it was trivial to integrate them into an existing app over time, no need to do a full conversion on day one. They also seem entirely React idiomatic, I've learned a lot about how to build reusable components myself from their API.
Re:Angular 2 Final Released by pferdone on Thursday September 15, 2016 @05:15PM (#12509881)
The problem with material-ui is that a lot of their components don't follow material design guidelines like their tables for example. It looks good, but it's not material. react-mdl is much closer to material, but incomplete due to missing components. Angular seems to have the best implementation so far, but I'm looking forward to material-design-lite v2
Re:Angular 2 Final Released by devdoomari on Saturday September 17, 2016 @06:49AM (#12519988)
re:learned a lot about how to build reusable components myself from their API

material-ui's tutorials are really bad examples on this. They teach you to import from specific dir path inside material-ui. (e.g. import Pen from 'material-ui/lib/pen' or whatever)

Instead, they should recommend: import { Pen } from 'material-ui' since most of their exports are already in material-ui/src/index.js file (or some index.js file from package.json's main part)

Re:Angular 2 Final Released by kinkdr on Thursday September 15, 2016 @02:32PM (#12508569)
I was put off by their TextField implementation. Their oversized <input> element doesn't play well with browsers, eg. the browser's auto-complete looks completely out of space.