-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Allow html in title attributes in tab-pane directive #67
Conversation
It is common to add icons in tab title, usually with <i class="icon-xxxx"> while using bootstrap. So I think the default template should allow this, either using ng-bind-html-unsafe or ng-bind-html with ngSanitize,
@jmaynier thnx for your contribution! Would you mind adding unit tests? |
I am not that keen on this unsafe binding. It could be a potential security flaw. Is there not a better way to work this? I was looking at specialized transclusion earlier. I believe this is a use case. |
@petebacondarwin indeed, would be cool if we could limit the subset of tags to be used in a title. We could create a specialized filter for this maybe? |
Sure, someone could put |
But, without looking at the code, the developer wouldn't necessarily know that the title/heading binding is being displayed as an unsafe binding. If you want to put the responsibility on the developer then the attribute should be called |
Why not have 2 attributes, title as it works now and html-title that would be used in an ng-bind-html in the template. The use of html-title would require the inclusion of ngSanitize ? |
@jmaynier That sounds like a fair idea. |
@ajoslin @jmaynier I'm not sure but from what I understand we can't conditionally include a module ( I'm not excited about the idea of using I hope I'm missing an obvious solution here as having some basic HTML it a title (b, i, etc.) sounds like a good idea... |
I think if you are going to pass HTML to a directive it should be via a On 25 January 2013 18:58, Pawel Kozlowski [email protected] wrote:
|
@petebacondarwin I hear what you are saying but how this would work in practice? Would it require an additional element ( If we can't come up with a nice syntax I would be leaning toward using |
Similar to HTML4 or HTML5 andOn 26 January 2013 21:04, Pawel Kozlowski [email protected] wrote:
|
@petebacondarwin Peter, I can see the general idea but could you propose the exact syntax? What I'm afraid of that the syntax might get so verbose that it might defeat the whole purpose of this directive. At least the proposals I was coming up with were really verbose... |
So we have two options: 1. Pane with
2. Pane with
I really kind of like the child element directive like @petebacondarwin said. It's verbose, but it works. |
I am really not keen on html inside attributes! It is actually quite easy to implement the |
Escape key was not being handled when no items are found in a search.
It is common to add icons in tab title, usually with while using bootstrap.
So I think the default template should allow this, either using ng-bind-html-unsafe or ng-bind-html with ngSanitize,