Angular 2 docs for ES6/7
github.com
github.com
This is just one of many things that should make people think twice about using Angular 2. The fact the team seemingly take input from a select handful of "Google experts" to guide the framework should be an alarm bell in itself. NG2 is a monolithic and over-engineered framework backed by a company who have proven they conflict with themselves (Polymer) and deprecate popular services on a whim (Google Reader).
I personally use TypeScript in my Aurelia applications, but I think you should allow developers to write using straight-up Javascript. We're getting to the point (or if you're writing evergreen focused web applications, you're there now) where we will be able to write Javascript without a transpiler soon (for most things).
I love TypeScript, but we can't forget what it's a subset of and some have the view that Javascript doesn't need types or interfaces.
I see this happening too often but I don't see how that happened in the parent comment though.
It's a tiny bit of a stretch to call it a whine, but it's old when it's brought up constantly, tbh.
Isn't Google using Dart internally ? From what I've seen all their NG2 projects use the Dart version and their Material design component lib is Dart ?
So if what you were saying was true they would dump the TS/JS version and migrate the team to work on the Dart version 100% and not maintain two separate code bases (like they are now after the Dart/TS source split) and wouldn't even bother with the Material design for TS ?
Honestly I'm not even sure why Google is spending all this effort on the ng2 TS/JS as what I said above would make more business sense - I doubt that ng2 is making them any money if they aren't using it (I'm talking about the TS version).
It's not accurate to say that AngularDart exists first and foremost to meet the needs of one internal team - it exists to provide a great framework for apps of this type (significant, complex web apps).
We think we're making pretty awesome progress here - we've been able to dramatically increase velocity since the source split (a couple of months ago), and have made really large improvements already in application performance and in shrinking the size of the compiled JS for AngularDart apps.
What am i missing?
They do, just not ES6. "The examples of the docs are planned to be written in TS, ES5 and Dart". I tend to agree with their argument that if you're using ES6, why not just use TS.
Moreover ES6 is almost fully supported by current browsers (besides IE11) so you don't have to use transpiler (which adds a performance overhead).
I guess why it's tailored to them is somewhat self explanatory -- they want a framework that handles the specific frontend needs their projects have.
Even if we could use ES6 JavaScript in the browser, transpilation isn't going away completely because we need HTML, uglification, vendor-libs, etc to be brought in together before deploying to production.
WARNING: If you are starting off with React+Typescript, expect to bang your head for may be, a couple of days, to get that stuff working. However, once it does work, it saves much more time and effort
To digress a little, AngularJS 2 has been awesome, and at times can be simpler than React. The .js and .js.map file bulk with every .ts file is stupid though.
However...
Routing in AngularJS 2.
It is bad.
Very bad.
Object oriented programming is by origin (Smalltalk) dynamically typed. Class based programming languages (which we really shouldnt consider typical for oop) tend to borrow all their modern type features from functional programming languages. (Think polymorphism, generics, interfaces, etc.)
Yes. JavaScript's structure is usually heavily functional and can often be non-modular. Typescript goes away from this somewhat with the construction of objects.
> Object oriented programming is by origin (Smalltalk) dynamically typed.
Really? Object orientation is all about forming your own types, so how could OOP have an origin in dynamic types?
Personally i wouldn't call javascript functional but...
Maybe that's just anecdotal though, since I know that JS supports some form of OOP.
I think OP is talking about the narrower scope of Angular 2 + TS vs React + JS
I'm curious what you don't like about the Angular2 router. Since router 3.0 (agreed there were some false starts) I've found it to be a pleasure to work with.
Not sure if I'm just bad though, I suppose i'll keep on trying.
Routing and E2E testing are my biggest concerns for transitioning our 1.x app to Angular2 -- and I haven't had time to really dig into either in detail.
The amount of code and files you need for a very basic login-auth feature for a page is extremely large.
I feel like, after 2 weeks, AJS2 is built for large websites for huge companies, and pointlessly complex and boilerplatey for small websites like a forum, blog, simple store/story site, etc.. I think that if you want to make hundreds of pages, AJS2 or something is your bet, but for a little thing, go with PHP 7.
As a counter point, with ngrx/store being so popular in Angular2 land I doubt Angular2 is as friendly to the Enterprise as you make it sound. On top of Redux you have Rx, many people will have a hard time wrapping their heads around this.
If you do try to eliminate all of this work at run-time, by creating type-specialized versions of every method, you have the problem that code that tries to narrow a type by either casting, or doing an instance-of check on a supertype (like Object) needs special treatment.
All these choices were made long before they implemented 'generics', so most code was doing manual narrowing and casting all over the place, including the standard API's. Type-erasure would not actually improve the performance by much since it could hardly be used.
They solved the performance problem, without actually considering the type system. Your code runs just as fast, as if you used the Object type everywhere, and just cast on the fly to what you expect it to be. Which would be equivalent to a dynamically typed language.
ES6 is a superset for ES5, so given the ES5 docs you can write NG2 apps with ES6.
Typescript being a superset of ES6 means it would be a struggle to write an NG2 app in ES5 or ES6 given only the Typescript documentation. I tried during beta, it was an exercise in frustration that I finally abandoned.
Providing documentation for the lowest common denominator of ES5 should let you write in ES6 (heck, it should let you write in Typescript if you realyl wanted to!) But some of the dev's comments are a bit backwards IMO when they say use Typescript documentation for ES6.
You can see my beta NG2+vailla JS project here https://github.com/chad-autry/ng2bp
Almost all Angular2 projects, that claim to be using ES6, are in fact using ES6 + Babel Legacy Decorator plugin https://github.com/loganfsmyth/babel-plugin-transform-decora... . The legacy plugin adds syntactic sugar on top of ES6. This is no better than TypeScript in the first place.
Especially when we've got a gulp build process that takes long enough to run that I want to start some XKCD chair-jousting matches between edits.
Oh, you meant easier/more efficient/safer but only within the comfort zone...makes sense.
Or stop running every dependency through Babel (which is the biggest source of build slowness I've seen in the wild).
It's not a secret that we promote Typescript as the first choice for Angular2 - this is a conscious decision based on both technical reasoning as well as feedback from our developer community.
I can count on one hand the number of teams I've spoken to who really want to use ES6 - the vast majority are happy using Typescript.
Typescript also allows us to do the kind of static analysis we use to do ahead-of-time template compilation, something that is significantly more difficult with ES5/6 - we've discussed making this work in the future, but for now it's a lot of engineering investment for something there just isn't the demand for.
A couple of other things I want to mention - "enterprise" gets thrown around on HN sometimes as a bit of a dirty word. We don't see it like that at all - the vast majority of Angular 1 users are exactly enterprise, and we're solving for the problems that large teams like them run into.
Now we're released and stable, I think it's a reasonable ask to add some specific docs on ES6 usage (or at least where it differs from TS), I'll bring it up at the next docs meeting.
Anecdotally, my experience talking to outside teams tells me that TS is not the complexity problem people have - the vast majority of devs coming from ES5-land have trouble with ES modules and bundling, rather than the specifics of ES/TS itself - this is part of the reason we're working hard on the angular-CLI.
As far as Google/Angular's commitment to the outside world - we have a Developer Relations team (of which I'm at member) - our only job is making non-Google developers successful with Angular. Feel free to reach out to me (@robwormald) or @stephenfluin if you've got questions or concerns. We both come from "enterprise" webdev and a big part of our job is making sure outside developers are represented in eng-team decision making.
Also reach out if this is something you care about deeply and want to contribute to the documentation - we'd love your help and I'll put you in touch with the right people.
I know how much it hurts when you can't find decent documentation for Ng2 with ES6.
Is this a formatting bug or some new HN thing I'm not aware of?
EDIT: I guess formatting bug. The comment ends with a trailing <i> in the DOM inspector.