Closed MikeRyanDev closed 9 years ago
Nice work guys.
I would definitely prefer the ng2 syntax using the (), [] and [()], in addition to no brackets for text bindings.
@MikeRyan52 how much overhead? Is it runtime overhead or just coding effort or something else?
The same, I would prefer new Angular2 syntax. Didn't know that it's possible to do things like this in Angular1. @MikeRyan52 Nice research about that!
I love it!
Perhaps we could have a setting that either sets up the 'word-' variants or the 'character surrounding' variants. If that still is too much overhead I vote for the special character ones.
Now that we have working events we can simulate Angular 2 style events using this syntax:
and thanks to some work by @timkindberg and @Mitranim, we now support three types of property binding: text value, one way, and two way:
With these building blocks in place I was taking a look through the source for Angular's
$compile
service and noticed that it doesn't strip non-alphanumeric characters from scope bindings or directive names. To demonstrate I've created a new branch called proposal/template-syntax that changes both the event and properties builders so that the above examples could be rewritten like this:While the previous syntax would have worked just fine when ported over to Angular 2 (brackets and parens are just syntactic sugar for
bind-${prop}
andon-${event}
, respectively) it is pretty verbose and would be cumbersome to write out for components with a large property/event API.The only issue is that it would require a good bit of overhead to support both
on-*
/(*)
,bind-*
/[*]
, andbind-on-*
/[(*)]
. It would be best to to choose one syntax to support for v1 of ng-forward.