In AngularJS, you could specify @ (instead of =) in a directive in order to bind to plain text. So, with field: '@', you could set the scope.field value to the string "Hello, World" with the following HTML:
<my-tag field="Hello, World" />
In Angular 2, I am currently doing the following:
<my-tag [field]="'Hello, World'" />
Notice the single quotes inside the double quotes. Angular 2 is expecting the contents of the attribute to be an expression.
I was wondering if there is a short-hand to treat the attribute values as plain text? This will help avoid the mistake of forgetting the quotes, which I keep making.
Atleast in the latest version, you can do this in Angular 2 too:
<my-tag field="Hello, World" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With