Skip to content

Comment on Angular 1 and Angular 2 integration: the path to seamless upgradeparent

Comments

Others have pointed out that it is in fact syntactically valid HTML. It's also worth mentioning that this is syntactic sugar, and you can get the same behavior with:

  <input type="text" bindon-ng-model="model.name">
Similarly, property bindings surrounded by brackets "[myprop]" and event bindings surrounded by parens "(myevent)" are equivalent to the following:
  <input type="text" bind-myprop="model.foo" on-myevent="bar()">
All of angular2's template syntax can be replaced by more normal-looking tag properties with "reserved" prefixes that tell Angular what to do with them.[0] The less verbose symbols are probably easier for the eye to parse than the long forms once you're used to them, and either form can be easily analyzed and highlighted by an IDE.

[0]http://victorsavkin.com/post/119943127151/angular-2-template...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.