I'm using text-angular to save html-based content into database and i want to save checkboxes with the checked attribute on them. I've tried to use the input field like below but text-angular doesnt render checkboxes with checked attribute. Is there any way to do this without doing pure css checkboxes?
<input type="checkbox" checked>
EDIT : The code I am using:
<text-angular data-ng-model="example_content" placeholder="Content..."
rows="5">
And inside the textarea
of the text-angular
directive, I am trying to insert the input
from above but it renders without checked
attribute
您可以通过使用ng-click来实现
<input type='checkbox' ng-click='onsaveValue()' ng-model="saveValue">
I looked up in text-angular
's sanitizer library textAngular-sanitize.js
to find out that the checked
attribute isn't part of their htmlAttrs
attribute map .
Hence, the only option we're left with is to override the sanitizer JS file with the edit. Moreover, you can add other attributes/tags if you want (Do consider vulnerabilities though!)
Here's the working example plunker forked from official text-Angular
plunker. Notice the ta-sanitize.js
included in plunker which is modified version of their textAngular-sanitize.js
Hope this helps!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.