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&rsquo;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&rsquo;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&rsquo;re is displayed. Any idea on what I am doing wrong.


They&rsquo;re



Thanks in advance.




2 Answers
2



Try putting your value in quotes when you set it...


vm.addressPlaceholder = 'They&rsquo;re'



and then remove the curly braces and set it in the markup like so


e-placeholder="vm.addressPlaceholder"





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





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.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế