How to pass a string value to a component in angular2
Solution 1:
String literals can be passed in different ways:
<component inputField="string"></component>
<component [inputField]="'string'"></component>
<component inputField="{{'string'}}"></component>
Solution 2:
You can pass a string by enclosing the string in quotes
<component [inputField]="'string'"></component>
Solution 3:
To include a single quote (and possibly other special HTML characters) in the string literal the first option works while those that use single quotes to wrap the literal fail with parse errors. For example:
<component inputField="John's Value"></component>
Will output "John's Value" correctly.