News for hackers. Stuff that matters.
Re:Angular 2 Final Released by dvdcxn on Thursday September 15, 2016 @06:55AM (#12504896)
>The HTML template in Angular 2 is stored in a string. This has several disadvantages

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

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

Re:Angular 2 Final Released by bcherny on Thursday September 15, 2016 @01:11PM (#12507883)
If you're using TypeScript + templateUrl, you won't get static checking of templates. With React + TypeScript, you will.
Re:Angular 2 Final Released by marpstar on Thursday September 15, 2016 @08:37PM (#12511104)
This is literally the only thing in our Angular2 setup that I'm really missing. Besides that, I've really enjoyed working with it (by way of Ionic 2)
Re:Angular 2 Final Released by dvdcxn on Thursday September 15, 2016 @01:23PM (#12508012)
Seems more like a tooling issue than language issue to me. Angular2 is much more immature than React. Let the IDEs/text editors catch up.
Re:Angular 2 Final Released by akst on Thursday September 15, 2016 @10:58AM (#12506689)
Does Angular 2 do any compiler magic with these templates? or are the templates parsed at runtime?
Re:Angular 2 Final Released by robwormald on Thursday September 15, 2016 @02:18PM (#12508461)
we can do both. In JIT mode, we XHR for them and compile them on the fly. In AOT mode, we do that at build time and turn the templates into TS code, which we can then typecheck (thus giving you typechecking against templates) - the benefit of this is you don't have to ship the compiler code to the browser, don't pay the cost of runtime compilation, and the generated code is monomorphic and thus highly optimizable in browser VMs.
Re:Angular 2 Final Released by akst on Friday September 16, 2016 @11:52AM (#12514842)
Oh cool, sounds similar to what Ember is doing with it's glimmer engine. Are you guys compiling it down to dom api, like htmlbars did? or something similar to a VM style runtime like in Ember's Glimmer 2, where templates are compiled down to a series of opcodes? Or something entirely different from those approaches?
Re:Angular 2 Final Released by mbreedlove on Thursday September 15, 2016 @10:18AM (#12506330)
+1 for templateUrl. It really should be the de facto way of handling markup.