-
Notifications
You must be signed in to change notification settings - Fork 124
HTML Binding for Labels #27
base: master
Are you sure you want to change the base?
Conversation
Here's the example code you can add to the gh-pages: <h3> <a name="html-bind" class="anchor" href="#html-bind"><span class="octicon octicon-link"></span></a>HTML Bind</h3>
<div class="highlight highlight-html"><pre><span class="nt"><toggle-switch</span>
<span class="na">model=</span><span class="s">"switchStatus"</span>
<span class="na">html=</span><span class="s">"true"</span>
<span class="na">knob-label=</span><span class="s">"<strong>##</strong>"</span>
<span class="na">on-label=</span><span class="s">"<em>Puppies!</em>"</span>
<span class="na">off-label=</span><span class="s">"<del>Puppies</del>"</span><span class="nt">></span>
<span class="nt"><toggle-switch></span>
</pre></div>
<toggle-switch model="switchState" html="true" knob-label="<strong>##</strong>" on-label="<em>Puppies!</em>" off-label="<del>Puppies</del>"></toggle-switch> |
Does ngSanitize have a angular version requirement? |
It's a standard angular module. https://docs.angularjs.org/api/ngSanitize I'm not sure what Angular version it was introduced in.
|
I see docs for it in 1.0.8. Not much there but looks like it should be good. |
Did you want me to update the branch with the dependency set to version 1.0.8? |
I don't mean to bother, but when do you think this will be pulled in? |
Could this be made simpler with two different templates? On Mon, May 26, 2014 at 10:51 AM, Mark Pearce [email protected]
|
The issue I ran into is that the existing tests expect the new (generated by the directive) HTML to be child nodes of the actual node. That's why theres a template and an innerTemplate in the link function. Also, this makes it so we don't duplicate any code around the class names or ng-class calls. |
Any update on this pull request ? |
I actually switched to using https://github.com/JumpLink/angular-toggle-switch It has html binding for labels an a more bootstrap 3-like styling, too
|
Thanks @markwpearce, I will try it. |
I added the ability to use "ng-bind-html" for the labels on the toggle switch.
In order to do this, it now requires ngSanitize.
To make the switch use html binding, simply add a "html" attribute to the switch: