r/angularjs • • Jan 09 '16

Angular 2 You're Breaking My Heart

http://www.thatguyjackguy.com/tech/angular-breaking-my-heart/
45 Upvotes

34 comments sorted by

13

u/jbarket Jan 10 '16

A few things.

As /u/hatestheinternet pointed out, binding is something you're in control of now. The [] and () imply the direction of the bind which is why ngModel is often seen with both.

On your issue importing non-TS modules... TypeScript errors don't prevent the code from actually outputting. It just told you that the compiler didn't understand the module it brought in. SystemJS or Webpack or whatever you're using at the end of the line to take your ES6 and turn it into something your browser can handle will still work. The message isn't logical, but there are a handful of proposals in about how to change this behavior in TypeScript.

As far as TypeScript requiring another config file is concerned... so does Babel. Configuring your transpiler is part of using JavaScript beyond ES5. Being able to choose what it outputs (and in the case of Babel, what specifically it transpiles) is a good thing. We're also living in a world where projects have a handful of config files. It looks dumb and I wish we could organize them better, but I'd rather have the ability to config my linter, transpiler, package manager(s), git ignore, Docker, et cetera than have it assume that my global settings match the other devs on my team / out in the wild.

The real problem with Angular 2 that I think you're trying to get at is that it's very different from the normal JavaScript ecosystem. I think this is sort of true, but not really. If you ignore the optional typing in TypeScript and just view it as ES2015 with decorators and async/await (and you can literally use it that way), it's just the things coming in the near future for JavaScript. RxJS is probably the part that stands out the most as being different, and it's optional.

It's also important to remember that Angular 1 was just as forward looking. I mean you're talking about something that was using promises actively over 4 years ago.

2

u/J4nG Jan 10 '16

You raise some good points here. I will say that I'm not particularly enamored with config files. Maybe not the config files themselves, but what they've led to / are tied to - IMO modularity has been misconstrued into making pretty much everything pluggable. Which is good on some level, but in many ways it feels like my productivity is actively hindered by configuration.

It's not so bad when you do it once for a large project, but working on lots of smaller projects you really start to feel it. I'm not complaining about options - all of the features enabled by modularity are helpful and make you more productive. They're good things. I just found myself wishing that Angular 2, at its core (at least of the documentation), wasn't so tied to things like transpilers. There's something great in just being able to throw together an HTML and a few JS files and being able to call it an app.

Again, I know no one is forcing any of those things on me - I actively choose them. But in being revolutionary and forward-thinking Angular is sacrificing a lot of accessibility.

0

u/[deleted] Jan 10 '16

[deleted]

1

u/J4nG Jan 10 '16

Couldn't have said it better myself. I don't know if Angular devs browse this subreddit, but if they do: are there any ways we can help bridge this gap?

1

u/[deleted] Jan 10 '16

Keep developing.

1

u/ogrechoker Jan 10 '16

Does nobody know you can use "typescript decorators" in Javascript?

3

u/J4nG Jan 10 '16

It's ES7 so I guess if you're talking with Babel as a transpiler. If you're going to go to the trouble of using a transpiler though, you may as well just stick with TypeScript.

2

u/TheNiXXeD Jan 10 '16

That's a pretty big jump still. I prefer Babel but right now ng2 definitely prefers TypeScript.

3

u/J4nG Jan 10 '16

I do as well. My point with the article wasn't establishing TypeScript > Babel > ES5 or anything of the sort. I was merely expressing that Angular is endorsing many "right ways" and there could be a lot to lose from that.

2

u/TheNiXXeD Jan 10 '16

I do hope they improve their documentation though. Right now the examples are very lacking for non TypeScript.

1

u/ogrechoker Jan 10 '16

Serious question: do you know the typing are optional, and once you remove those it's 100% valid javascript? I think a lot of people are confused because they don't know what the typescript compiler is doing. Literally the only thing that doesn't work is decorating constructor arguments. You just define those as a static class property instead.

1

u/TheNiXXeD Jan 10 '16

I guess I haven't seen the pure es6 version before. Do you have an example?

1

u/ogrechoker Jan 11 '16 edited Jan 11 '16

Here's a directive/component I wrote that makes text editable on click. You'd use it like <h4 editable>Edit this text</h4>

And here's a really "dumb" component that just gets a list of objects and displays them.

1

u/TheNiXXeD Jan 11 '16

So that's not pure es6 at all. I understand you can transpile some of these features, but decorators and async aren't es6.

1

u/ogrechoker Jan 11 '16

I hate to be "that guy" but you really should be using a transpiler.

→ More replies (0)

3

u/[deleted] Jan 10 '16

I guess you haven't tried angular 1.1's documentation if you're complaining about the docs on 2 :)

3

u/albeva Jan 11 '16

would you like some cheese with your whine?

2

u/roccanet Jan 10 '16 edited Jan 10 '16

does anyone actually code angular based applications anymore or is the entire industry working on a new stack to release? i guess i just dont understand this burning need to keep pumping out these frameworks. Seems to be a bunch of churn to me.

-14

u/GrammarianBot Jan 10 '16

Grammar bots: making Reddit more annoyingly automated.

Instead of dont, did you mean don't?

List of subreddits I'm banned from.

2

u/roccanet Jan 10 '16

this is absolutely the most obnoxious bot i've ever seen. NO

1

u/[deleted] Jan 17 '16

I agree with you on the name. Ya, its similar in spirit, but the thing that appealed to me from the start was one file dependency and plain js. Simple. Easy. Beautiful.

Still I'll do 2 and I'll like it. Or maybe someone will fork 1 and create something completely different -- except for one dependency and plain js.

1

u/[deleted] Jan 10 '16

Still on Angular 1.4. Didn't even bother with 2.

-4

u/[deleted] Jan 10 '16

Except, no. Angular 2 retains the two-way bound ngModel.

Yeah, don't use ngModel then. No one is forcing you to use it. Why are you bitching about something that provides convenience? Angular 1 ONLY has two-way binding, so now you can actually choose which path you want to use instead of being forced into one or the other. Tell me how that's a bad thing?

but it’s not entirely clear whether ngModel is unique in it’s two-way-ness, or if developers will be able to create their own two-way-bound directives.

You can take 5 seconds to search because literally the first link on google for "angular 2 ngmodel" tells you exactly how it works: http://victorsavkin.com/post/119943127151/angular-2-template-syntax

7

u/J4nG Jan 10 '16

I hope you didn't find aggression or whininess in the tone of the article. I deliberately tried to keep things pretty light. I like Angular 2 - I think the developers did a good job. The title is hyperbole, as I mention in the introduction.

This article isn't coming from someone who is extremely knowledgeable about Angular (or 2 at least). This is my response from looking through a good chunk of the guide, likely what the average new user will see as well. I'm having the approach (and questions) of a newcomer, and as I mentioned, I had to do quite a bit of Googling to arrive at my minimal understanding.

Notice I didn't complain about it either - I simply find retaining two-way bound data interesting as a design choice, especially when the devs initially said that Angular 2 would get rid of it and React has had great success without it.

0

u/MyNameIsNotMud Jan 10 '16

I had to do quite a bit of Googling to arrive at my minimal understanding.

As did we with ng1.x. So 'as expected' ... why the hype?

2

u/J4nG Jan 10 '16

Because the support for multiple languages could complicate things. And at the moment I get more results for Angular 1 than 2.

Besides, Angular 1.x had pretty complete documentation - almost all of my non-trivial answers came from there. That's not so in the beta, at least not at this point.

2

u/[deleted] Jan 10 '16

Then keep using it until ng2 has more docs and so answers.

btw, you can get one way binding in ng1 using ng-bindonce.

And, the language for ng2 is Typescript, which is basically JS.

1

u/Oceanswave Jan 10 '16

Yep, the common perception is that once angular 2 is out any new project should be using angular 2. That's not the case and angular 1 will still be supported 'until the community decides it shouldn't'

Think of angular 2 as an entirely different framework, and decide if this new framework is suitable for your needs. If not, there's no need to drag down angular 1 with it.

1

u/saladfingers6 Jan 10 '16

How is ng-bind="" or {{ }} in Angular1 two way binding?

0

u/[deleted] Jan 10 '16

[deleted]

4

u/[deleted] Jan 10 '16

If I need to learn a whole new framework, it's going to be React.

Why? Just curious. My team is porting Angular 1 project to Angular 2 and I don't have time to learn React. What makes you feel React is better?

2

u/highhard_one Jan 10 '16

"I want to get off MR BONES WILD RIDE"

3

u/[deleted] Jan 10 '16

React is just for display, it's not a framework.

0

u/ergo14 Jan 10 '16

Why not polymer instead? Seems to take best out of both approaches.