If you're using TypeScript + templateUrl, you won't get static checking of templates. With React + TypeScript, you will.
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)
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.
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.
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.
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.