-
-
Notifications
You must be signed in to change notification settings - Fork 501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular 2 bindings #683
Comments
I agree. I really love Slim but just found that I may not be able to use it for Angular 2. In addition to using parenthesis as noted above, Angular 2 also uses the pound sign sometimes in tags as well, a la:
|
+1 |
Rather than trying to get a grip on all this messing with new javascript html syntaxes, It would be convenient to have something we can wrap around the attributes so that they are not processed at all and just kept as is. For example it could be something like this: .my-item#custom-item{ #selectedItem *ngFor='item in items' (click)='selectItem()' } (Note: I did not look to see if this syntax is already used for something else but you get the idea) |
I think @westonganger's solution is the most practical, essentially allow one of the outer brace choices for attributes be one that allows for literal and flexible attribute naming within. Since I believe this causes an error now I'm hard pressed to come up with a practical example of where this might cause a breaking change. If absolutely necessary though it could be feature flagged until the next major version number. |
Hi. According to documentation, it is possible to pass hash via *. So this code will work:
compiles to
Looks a bit ugly, but for now it's the only way. |
That's not too bad actually. At least it is an option. For now we are just using the SLIM safe attributes like However given that SLIM supports It is worth noting Pug templates have a similar problem and ng2 style attributes must be quoted to work: https://pugjs.org/language/attributes.html. |
I've just tested different slim configuration options. So, with this settings:
It is pottible to write this code:
Compiled result is:
Looks like works everything, but *ngIf and others with asterisk. |
Looks like I found a working solution. So, this code works:
Compiled result:
UPD: added configuration option for splat attributes regexp. Original value is |
Awesome now to try this with slm-lang as well |
It seems we can handle this without breaking changes, see #739. I am looking forward to support this if someone is willing to write the necessary patch. |
I have commited required changes in #739 |
Hi, thx for the patch. Unfortunately it is not as simple as that. The patch is not ready to be merged for the following reasons and I don't have the time to fix it myself.
If you have time to work on those issues it would be great. |
Hi. Made some updates in #739. Looks like everything but changelog from list above is completed. |
It is ok to close this one? |
Hi,
I wanted to try to integrate Angular 2 to my Rails app, but I quickly ran into a problem.
The new binding syntax: https://angular.io/docs/ts/latest/guide/template-syntax.html#!#binding-syntax
Example:
I can use the other option for now:
But it would be nice to have both options. The round brackets around the (click) are breaking the templates, any plan to support that?
Thx!! :)
The text was updated successfully, but these errors were encountered: