I'm trying to complete something that should be fairly simple, in my opinion. And it also is, when using something like a text input. I'm trying to create model binding, on a textarea, where the value, when the user is typing, is shown with a prefix and a suffix. The prefix and suffix being quotation marks:
“My awesome quote”
The problem is, that i'm currently using ng-model, which i ofcourse cannot use for this. I was thinking about binding to a variable, holding the value without the prefix and suffix, and then watching that variable. When the variable, with the original value, then changes, i would write the value with a pre and suffix to another variable, on the scope. That variable would then be shown in the textarea, as the user types. The only problem is, that a textarea, unlike an input field, doesn't have a value property.
Is this even possible?
EDIT
If i where to achieve this with an input text field, i would create a variable called A, to hold the raw value that changes when the user is typing. When A changes, i would then take the raw value, put quotes around it and store that new value in another variable, also on the scope. That new variable is called B
The input field would then use ng-bind on the A variable, and show the content from the B variable, using the input fields value attribute. Something like below:
<input type="text" ng-bind="A" value="{{B}}">
I don't have time to create a fiddle right now, but i will try to do it later this week. The description above is all in theory, as i have not tested it yet.