top | item 13945689

Angular 4.0.0 Now Available

329 points| theodorejb | 9 years ago |angularjs.blogspot.com | reply

345 comments

order
[+] ssijak|9 years ago|reply
Hmm. I see that Angular is getting aaaaalot of hate here. I really tried to understand why but have not found really valid reasons, just preferences. I have used Angular 1.x a lot and have just tried Angular 2. It really enables me (somebody who comes from primarily strong backend dev experience) to work on frontend SPA apps productively and fast.

It does not 'feel' heavyweight or that it gets in my way too much, but the contrary is true. Of course, it has it`s quirks, as every larger lib have, but it`s pluses outweigh minuses by far for me.

Preferences aside, does Angular make you less productive than other options? Do you feel that you fight the framework? Can you finish non trivial frontend apps, involving 5+ team members, 'better', with cleaner code and much faster with other options?

This are just honest questions. I wanted to start some pet project in angular2 soon, but would listen to alternatives, maybe it is a right moment to try some of them.

[+] danielpatrick|9 years ago|reply
I've been using Angular 2 for a medium sized application that will be going into production within the next few weeks. I'm not affiliated with the Angular team at all.

I started using it when this app was very much a POC last summer, just as the Angular team was finishing up the 2.0 release.

I learned firsthand last summer the issues with using a framework that was still in the oven: constant updates and some dependency changes. That was no fun for some time.

But I'll say now that it was worth it. (Maybe I should have started a little later, post-2.0 release). But I'm now building out a decent sized and complex application much faster than I'd ever done before.

It is strongly typed, it is modular, and it has dependency injection. Oh and it's strongly typed. I can't emphasize the importance of this enough. I know you can use typescript without Angular, but that the Angular community and the docs are all in typescript make this a typescript-native framework.

I'll never look at JavaScript again if I don't have to. You and your IDE and the rest of your team can know an object's Type without having to scrounge around, it's such a blissful departure from JavaScript.

It definitely has a learning curve. If you're spinning up a simple web app it may or may not be for you. (...though now I use it to spin up simple web apps because I'm used to it and it's so good for that) But for anything complex that is being worked on across a team, I recommend you take the time to learn it.

It's not perfect, nothing is. But it is leagues ahead of any framework I've used on the front end. And having gone to Typescript, I will never use a native JavaScript framework again.

[+] azurelogic|9 years ago|reply
Try Vue.js. It's what Angular 2 could have been, if they had taken proper advantage of ES2015 and virtual DOM. Another way of looking at it: Angular 1 and React had a baby, and they named it Vue.js.

Vue has HTML templates like Angular and virtual DOM like React. It is faster than both of them. It has a smaller file size than both of them. It has a clever single file component concept that makes developing components much easier. It uses a one-way data flow concept like React+Flux. Vue even has it's own competitor to redux/mobX called Vuex, and what makes it easier is that Vue is cognizant of Vuex's existence. There are really solid dev tools for Chrome as well (Vue and Vuex are aware of the dev tools as well).

I run a dev meetup, and I had planned to give a talk there on Angular 2. I even gave talks on JS tooling a year ago and TS last summer in preparation. Instead, I gave a talk on Vue this month, and people loved it. Here are the slides if you want to check it out (there are even embedded Vue apps!): https://azurelogic.github.io/vue-js-2.x-talk/#/

[+] zdragnar|9 years ago|reply
I have built multi-10k+ line applications in angular 1, 2 and react. My personal preference is react by a mile.

The concept of modules and dependency injection was nice before we had any sort of module systems, but at this point it's essentially entirely busy work, given tools like proxyquire when testing.

Template compilation errors are a nice step up from 1, but those that I've seen have been very misleading and have been the cause of wasted hours debugging.

Angular 2 makes extensive use of the Reflection API for metadata, which combined with the fact that angular-cli is hard-coded to perform static analysis (even if you disable AOT) is another pain point. I'm trying to build the equivalent to "react storybook" for our platform, and it's taken me about 3x the time it would have with React.

With all of that said, if you need a "think-inside-the-box" tool for a large, decentralized dev team, angular can win out- there are fewer places to look for documentation, which will be nice when angulars documentation improves.

I actually find that React better encourages smaller, cleaner components with fewer responsibilities, but that's also likely due to being very familiar with the redux paradigm.

Finally, if you want very flexible components, react wins hands down, because components can be used as properties to other components; dynamically rendering components in angular has always had an inversion of control issue.

That's been my experience; ymmv.

[+] daliwali|9 years ago|reply
There is probably a non-trivial amount of astroturfing here, but also software developers are people too, and people get dogmatic about their opinions.

I probably won't ever use Angular unless I find myself desperate for work and can't find anything else. The problem I see inherent in frameworks is that they are all dogmatic about their opinions, and thus criticism of frameworks often do boil down to "I don't agree with their opinion", sometimes with rationalizations mixed in.

Preferences aside, Angular is objectively one of, if not the most, heaviest frameworks for web front-ends. It is not just a matter of bandwidth to the end user, but also a lot of magic under the hood that developers have to deal with. Consider the Java mindset that may have inspired Angular, people don't want to deal with that level of verbosity and enterprise mentality.

Unfortunately, there are increasingly few employment options if you want to use anything other than React or Angular. So rather than framing this argument in terms of framework hate, consider it a problem that lots of developers are forced to use these frameworks in order to be more like easily replaceable cogs in a machine, or be unemployed.

[+] tomelders|9 years ago|reply
I've got experience with Angular 1, 2, React+Redux, with teams of 5+

For me, the real problems in web app development are

1. State management

2. Side effects

3. View layer performance

Angular pales by comparison to things like React+Redux which were born out of necessity, and as such, tackle those issues with laser like focus.

Angular doesn't feel like it was born out of necessity, but out of some desire to just build a framework. As such, it's complicated and magical feels clumsy by comparison.

When combined with things like Immutable, Sagas, and ReSelect, the Redux/React style of architecture (feel free to swap out Redux or React for whatever you prefer) is so much more practical and useful compared to Angular.

I don't know what it is that makes Angular popular with back end developers, but they seem to be Angular's biggest supporters. I consider my self full stack, but front end first, and I've noticed that people like me tend to favour libraries over frameworks. There's obviously something that is informing each groups opinions on this matter, but I don't know what it is.

[+] shadowmint|9 years ago|reply
I can only speak from personal experience, but I've worked on 2 SPA angular apps that were both a nightmare.

The react apps I've worked on have been much more successful; we haven't had to throw the whole thing away (unlike one of those angular ones...)

I'm sure other people have had other experiences, but after two terrible experiences, the questions I would ask are:

- Why would I bother looking at angular again?

- What has significantly changed in the last year to reduce the complexity, increase the component ecosystem or increase the quality and quantity of the documentation?

If you can't answer either of those with meaningful answers, I don't see any reason, given the other alternatives to angular that are around, to try using it again.

[+] hamstercat|9 years ago|reply
I started with Angular 1 and like it very much. Like you said, it enabled me to structure the code a certain way that made understanding it easier. I tried Aurelia since and moved on to React, and I have to say that while I still like Angular, not having to deal with state and mutability everywhere is a big boon to productivity. Whenever I code a component, I can simply think of the props (it's parameters) and the output (the HTML).

That being said, Angular is still a valid option (haven't tried Angular 2, but from what I've read it's a nice upgrade over Angular 1). I'd still take React any day of the week over it, just for the simplicity it brings. Of course there are other drawbacks to using it, but nothing's perfect.

[+] hashkb|9 years ago|reply
What else have you used? Having spent time in both Angular and React, I can say from experience I'm more productive and less angry while working in React. Less to learn, much simpler, yet no less powerful.
[+] boubiyeah|9 years ago|reply
Angular is a huge framework with a very OO style written by java devs. You have to learn many things to be productive with it, including a really weird string templating language.

The most funny thing probably is the typescript sale pitch (I use and like typescript) where you actually don't beneficiate from typescript at all with half of angular (string templates means no type checking or intelliSense on component names, model properties, component apis, etc)

It's also pretty fat and not exactly performant. It's simply a no-no on mobile. Its niche use case seems to be backend developers who know OO well, FP not so much, developing low/average quality back-office apps quickly without having to care about what's going on behind the scene.

The angular core devs always favor magic and shortcuts over simplicity. Its API surface is enormous, so have fun keeping up with the versions. It's optimized to get started quickly and be decently productive as long as you only use the core directives.

It's not terrible, but it's just not good if you care about the UX and maintainability of your app.

[+] Touche|9 years ago|reply
I still need a good reason why I need DI built into a framework and the following is not sufficient:

  SomeClass.SomeDep = MockDep;
In other words, inject through static properties. I do this with normal classes to test models and the like with no issues. No DI container necessary.
[+] smdz|9 years ago|reply
Angular 1 was great. It was first of its kind. And it was just a bit complex - but not too much.

Ng2 felt too different. Ng1 to Ng2 made me look outside and there was React gaining ground - perfect timing. In its original state React is so much simpler than Angular. But then React with just the basics can make you create bad code - that's what happened to me. React with best practices - is hard to digest.

So I went back to Ng2 - soon enough I was craving to go back to React. Suddenly I started hating Angular2 (but loved TypeScript).

I spent time learning React best practices - that require some patience. But one thing I brought on from Ng2 was TypeScript. TS makes you a lot more productive. Now React and TS is not a widely accepted combination - but its very productive as your app grows.

[+] andrei_says_|9 years ago|reply
Please take a look at Vue.js. I'm being redundant, intentionally.

There's something about it -- feels clean and minimal, works really well with my ruby- and rails- influenced mind, organizes my thinking about an app and makes it easy to have things in their right places, at a correct level of abstraction, effortlessly.

My reaction after encountering vuejs was one of relief -- finally seeing an option I resonate with, a vision driven by someone whose thinking is aligned with my desire to avoid confusion, complexity and frustration.

The free screencasts at laracasts and egghead.io are quick and fantastic.

https://laracasts.com/series/learn-vue-2-step-by-step

[+] nck4222|9 years ago|reply
I loved working with angular. They lost us when they released angular 2. It was complete breaking changes and the upgrade path was a nightmare. They basically were forcing users to completely rewrite their front-end if they wanted to upgrade. So the team figured if we have to rewrite our front-end, what's keeping us on angular and why would we stick with a framework that doesn't seem to have any issues forcing it's users to do complete rewrites just to use the newest version?
[+] Syntaf|9 years ago|reply
I wrote https://www.smsforecast.com using Angular2 and personally love the changes made from 1.X, I'm happy to see 4.0 come out along with it's bug fixes and features.

1.X felt messy, but writing web apps in Angular > 2 feels really clean when done right.

[+] mstijak|9 years ago|reply
I would recommend CxJS as an alternative. It has the best mix of Angular and React features such as JSX based view, two-way data-binding, controllers. On top of that, a large collection of widgets and charts is included out of the box and we're soon to release a Material Design based theme.

https://cxjs.io/examples

Disclaimer: It's a commercial product and I'm the lead developer.

[+] Bahamut|9 years ago|reply
I have been leading a good sized Angular app for work for the past 8 months, and upgrading from v2 to v4 has been painless, even while having an AOT compilation build pipeline set up - the only modifications we had to do was switch OpaqueToken to InjectorToken, <template> to <ng-template>, and Renderer usage to Renderer2, and these weren't required to be done yet. We only did those changes to get ahead of the curve from the deprecation messages.

On first note, the codegen size decreased dramatically for AOT compiled builds - we went from ~600 KB vendor + app minified and gzipped (not counting 50 KB of polyfills) to ~400 KB. This is huge, and the boot speed feels even faster on first user load of the page!

Thanks to the Angular team for this fantastic work!

[+] doczoidberg|9 years ago|reply
I also had a painless upgrade from 2.4 to 4.0.

With angular-cli ng2 is now usable and in my opinion the best Javacript/typescript framework.

[+] EugeneOZ|9 years ago|reply
absolutely same experience in our case. Painless update with few template to ng-template ctrl+f changes.

Angular CLI stabilization is a much more important news, actually. One of mistakes of Angular team - Angular CLI had to be ready before Angular itself.

[+] Bahamut|9 years ago|reply
I forgot to mention one other change we had to do - we had to switch to the new @angular/animations package, but that was also a pretty simple switch.
[+] robwormald|9 years ago|reply
Angular core team here, we're pretty excited about this release.

Main change, as noted, is the new View Engine. The design doc[0] is worth a read if you're interested in front-end at all.

Happy to answer any questions!

[0] https://docs.google.com/document/d/195L4WaDSoI_kkW094LlShH6g...

[+] d2kx|9 years ago|reply
1) I'm still new to this, but why would someone not use Angular Universal/why is it not default? I have only read positives, but am sure there must be a reason.

2) Why do we need Angular Material 2, when Google's official Material Components Web project is meant to be used with all kinds of frameworks and even has framework integration examples with Angular2: https://github.com/material-components/material-components-w...

3) Should I follow Quickstart or CLI Quickstart in the docs to get started? I have heard that the CLI is recommended nowadays, but the Angular 4.0 release blog says the CLI isn't even stable.

[+] nkkollaw|9 years ago|reply
I have a question.

Who thought it was a good idea to make Angular 2 incompatible with Angular 1?

You had it, and you blew it. Most people aren't going to use any version of Angular, now, and have switched to React and Vue.

[+] fareesh|9 years ago|reply
We're using the universal fork of the CLI with the recent AOT (client side) patch for a current project. Will my upgrade path be straightforward? The project is a simple content based website which consumes a ruby API that we had built earlier. We use universal for setting up meta tags, crawlability, etc.
[+] akerro|9 years ago|reply
Can we expect Angular 4 best practices before 2020?
[+] adam77|9 years ago|reply
is it really smaller and faster. i got the impression the payload size reduction might come at a cost to render performance?
[+] tomc1985|9 years ago|reply
Is it me or has the Angular1 site received an update? Is that platform still supported?
[+] magic_beans|9 years ago|reply
"If you're interested in front-end at all"

Am I being dense? Shouldn't that be everyone reading this thread?

[+] georgefrick|9 years ago|reply
Community here has been pretty negative on this lately. So I'll just add I've been using Angular 2x and also Ionic 2 the last year or so with great success. One real benefit we saw was the ability to take a lot of Backbone code and just quickly port it (models to services, templates just back to html for a component, etc). This is helping us help our enterprise clients in conversions of both older front end code and older Java EE code (for example JSP + Struts => Restful + NG2X).
[+] otto_ortega|9 years ago|reply
VueJS is the only of these JavaScript UI Libraries/Frameworks I can stand... The only one whose syntax doesn't make my eyes bleed!... I can't wait for Alibaba's Weex to be officially released so Vue can be used for developing mobile apps too. Reusing components across platforms and the web is the only reason why I would like to jump into the JS wagon!
[+] camus2|9 years ago|reply
> VueJS is the only of these JavaScript UI Libraries/Frameworks I can stand...

Agreed. I just can't stand Angular's bloat, especially its IoC container. If I want to use one, then let me choose the one I want. A UI framework shouldn't come with it's own container it makes no sense. If this UI framework is too complicated to boostrap manually then it's too complicated at first place.

To make things clear I actually liked Angular 1 since it allows people to easily upgrade from jQuery and raw DOM.

[+] acoard|9 years ago|reply
Any word on when Weex will be released?

I've messed around with Quasar Framework[0], which lets you build mobile apps in Vue (Electron too). Seems like its inspired by Ionic. Still in dev, but I liked what I saw.

[0] http://quasar-framework.org/

[+] onion2k|9 years ago|reply
The only one whose syntax doesn't make my eyes bleed.

To me that sounds like choosing a tool based on the experience it gives the developer rather than the experience it gives the user. That's entirely the wrong way to pick what to build an app with. User experience is far more important.

(That's not a comment about Angular or Vue. They're both great, and you should use whichever is best for the web app you're writing.)

[+] tomelders|9 years ago|reply
I'll be that guy.

I'm sure the Angular team are great people, and they're clearly talented devs... but stay away from Angular.

It doesn't help with the problems you will actually face. Typed Javascript is a cargo cult. Angular just plain confusing for no apparent benefit. Dependency injection is bizarre. The distinction between modules, components, and directive is unnecessary. The Javascript community in general is moving away from OOP towards functional programming, but Angular has hitched it's wagon to OOP. It's reliance on the decorator pattern is maddening. It's view layer performance is sub standard. It's opinionated in all the wrong ways.

And I say this as someone with a lot of experience with Angular 1, Angular 2.

Trust me, go for libraries over frameworks every time. Redux, React, Immutable, Sagas, and reSelect. That's the future of web app development.

[+] aprdm|9 years ago|reply
Even with SemVer versions it looks really weird to see a new Angular relase branded as 4.0.0.

Angular 1 to Angular 2 made me drop angular entirely, that happened less than 6 months ago I believe.

Just reading Angular 4 gives me the creeps.

Is 4 widely different from 2? How am I suppose to know if you using semver and already have a really bad history?

[+] git-pull|9 years ago|reply
I'll probably try it.

But man, am I getting jaded about all this javascript framework stuff. Every 6 months stuff breaks, every 2 years there's a huge shift.

The problem with javascript I've been facing is value. Time and effort doesn't always correlate to what I get in the other end. In fact, I can say when building, going single-page is a time sink.

And it's almost always a mistake to go SPA first. Using a django or a rails lets you get the basics and data flow nailed down early on. Get into a framework too early and have a need to change something? Have fun explaining to your manager/client how costly it is to do a "simple" modification to a JS app when you have to throw the state you built it upon out the door.

What I want is a system tightly coupled into a server-side framework like a Django or a Rails that degrades gracefully and I only have to program the interactivity one time. Something that'd plop right into the asset pipeline/django compressor so I don't have to go outside of the framework to build.

Hundreds of hours of my life have been spent chasing this dream of sharing server side code with client side JS frameworks. That's what I need.

Meteor didn't do it for me. As for rendr, I've done stuff better with backbone/express in-house. As of 2017, I get my best bang for the buck using django and pjax. No joking, I went from full DRF + Backbone Marionette -> to plain old jquery and pjax and couldn't be happier.

All these new build tools (grunt, gulp, webpack... come on), ES versions (I was ok with ES5). None of these things are helping me ship stuff ahead of / on time and correctly. They're creating an even larger gap between the server side data, logic and templates and the JS interactivity.

If anyone is listening, I'd love to have a well-supported opinionated distribution of django or rails that just renders forms, tables, etc. with angular/react/etc. and degrades gracefully.

[+] elmigranto|9 years ago|reply
I'm so out of the loop… Feels like a week ago everyone talked about how cool and performant v2 will be when it's finally out of the beta and officially ready for production, and now there is v4 release.

What's going on with versions?

[+] awqrre|9 years ago|reply
Angular feels like it's there only to obfuscate the web's source code... (don't be shy if you think I need downvotes...)
[+] tribby|9 years ago|reply
increasingly, angular seems less like a tool I'd use and more like a platform that exists to sell typescript and generally influence the web.

in 2017 I'm curious why I'd pick angular over vue for a web-based project, if anyone has insight. not over "x js framework" -- over vue specifically. vue 2 is pretty much exactly what I wanted angular 2 to be.

[+] tannhaeuser|9 years ago|reply
First of all, congrats to the Angular team.

I'll say personally I've never been a fan of Angular, but I think if you want Java/J2EE-ish all-encompassing component model and decorator-/annotation-based GUIs, it certainly is a very strong contender (though kindof the thermonuclear option and absurdly complex IMHO, at least if you have some prior web development experience). I think Google's track record wrt. long-term maintainance isn't half bad really (GWT and closure tools have been around for a long time).

That said, I've recently talked to recruiters, and was told Angular has already peaked as the go-to framework for enterprise MVC web apps, and is replaced by React and others (and I'm assuming Angular wasn't all that much used outside that demographic because of the heavy setup and on boarding/buy-in).

In the course of JavaScript generational cycles I'm expecting we're bound to re-discover "evergreen" web apps, those being characterized by lack of heavy build pipelines, simple browser-refresh driven development cycles, and straightforward use of web forms (+ maybe components).

An open question for me is what about TypeScript, eg. since Angular has been a major driver/user behind its type-heavy approach, will it suffer along with Angular?

[+] alttab|9 years ago|reply
Rails, bootstrap, react when necessary on portions of pages. Use regular links again - use regular forms again, remember - AJAX can be cool, but it doesn't have to be the whole app.

Remember when the server generated HTML? You could middle click a link!

I'll even use normal browser history, instead of re-implementing it in Javascript for my app (with bugs).

[+] crudbug|9 years ago|reply
I tried react initially. As a Java developer, I needed types, rxjs, modules without the Hassel of webpack configs.

Angular provides consistent structure to your app. With angular-cli, consistent interface to front-end development. Having ported it from Ember, IMO the cli interface should be standard across all front-end frameworks.

I see it as microkernel like framework for front-end development. In Java land, we have OSGi standard for modular software component development, angular has sort-of similar design.

The only confusing part is NgModule, the team should rename angular modules as NgBundle - which consists of native TS modules.

I read somewhere, angular team is working on material widget library, please make style-less components with theming support.

[+] softwarefounder|9 years ago|reply
I'm using Knockout JS along with a micro hash-tag routing framework for my SPA. Couldn't be happier. Knockout JS is mature, and doesn't change. Yet there's still PR's that fix things here and there.

JS frameworks these days are such job creators. Which is great for consulting, but I don't want such mutability for my own products.

[+] zygimantasdev|9 years ago|reply
Using Angular2 for 10 months now. Can say it has been a pleasure to work with it. Sure there are some problems - but it is open source. Free. Can't be complaining about stuff you get for free ;)

One thing - name of the framework should have been something different. At first we thought it is going to be called Angular2 and later it became just Angular. You can imagine that whole community will have to rename their libraries and etc.

In overall, big thank you from our frontend team for giving us a great framework

[+] kabes|9 years ago|reply
Just reading about 'renderModuleFactory' in this announcement makes it sound enough like Java EE bullshit that I want to stay far away from it.
[+] dreamache|9 years ago|reply
Just a quick note to those who would like to play around with it..

Install the latest version of the CLI: npm install -g @angular/cli

And then run: ng new project-name --ng4

The "--ng4" flag is currently required, as it doesn't yet install ng4 by default.

[+] crudbug|9 years ago|reply
Congratulations to the team. I have been using Angular 2 for our internal operations dashboard.

I am seeing : platform-browser / platform-server namespace. Can we expect platform-android, platform-ios, platform-jvm ?

Looking at the angular compiler pipeline, with AST this should be possible ?

[+] vladimir-y|9 years ago|reply
Angular is being overengineered, why for example do you need dependency injection having modules system. It's better to go with VueJS, it can do all that is needed being simple, fast, lightweight and VERY developers friendly.
[+] voidmain0001|9 years ago|reply
I wonder what Rob Eisenberg formerly of Angular and now with Aurelia.io would have to say about v4?