Angularjs Placeholder (Attribute) Containing Smart Quote
Angularjs Placeholder (Attribute) Containing Smart Quote
I want to set the placeholder of an editable text area based on a value set in the controller. The placeholder text contains smart quotes. When I do this it works:
<div>
<p editable-textarea="vm.address" e-rows="8" e-name="address" e-ng-model="vm.address" e-ng-maxlength="vm.addressLimit"
e-maxlength="vm.addressLimit" e-placeholder="They’re"> '(empty)' </p>
</div>
This is displayed: "They’re".
However if I set e-placeholder to value defined in my controller it doesn't. For example if the controller has
vm.addressPlaceholder = 'They’re';
and the view
<div>
<p editable-textarea="vm.address" e-rows="8" e-name="address" e-ng-model="vm.address" e-ng-maxlength="vm.addressLimit"
e-maxlength="vm.addressLimit" e-placeholder="vm.addressPlaceholder"> '(empty)' </p>
</div>
They’re
is displayed. Any idea on what I am doing wrong.
They’re
Thanks in advance.
2 Answers
2
Try putting your value in quotes when you set it...
vm.addressPlaceholder = 'They’re'
and then remove the curly braces and set it in the markup like so
e-placeholder="vm.addressPlaceholder"
I'm sorry, I had single quotes in there as well that shouldn't have been...do you get the same behavior if you remove the single quotes?
– tcrite
Aug 23 at 0:40
Issue resolved. The problem had to do with the encoding. The javascript file was saved as ANSI. After changing the encoding to UTF-8, problem resolved.
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
My post should have contained quotes. Removing the curly braces treats the vm.addressPlaceholder as a vale as opposed to a variable.
– Roger
Aug 22 at 23:13