-
Notifications
You must be signed in to change notification settings - Fork 279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bo-html when using jQuery instead of jqLite #78
Comments
Look on the following implementation of angular.js (1.2.14):
The following line uses $sce.getTrustedHtml which you are not using. Adding it to line 183 of bindonce.js will solve this issue. |
The problem is that previous versions of Angular don't support $sce. I'm going to push a fix that will work also with AngularJs < 1.2 |
I think you can use the $injector.has() method to check for dependency. This way you can distinguish between $sce and $sanitize. But it is added only on 1.1.5. |
Yes, that's what I did: function getProvider(name) {
try {
return $injector.get(name);
} catch (e) {
return false;
}
} plus, in the coming version there is a bindonce provider that let you configure some parameters, one of these is the opportunity to turn sanitization on/off for html. I'm not totally sure it is the best approach, I'm considering adding an html-unsafe directive, what do you think? |
I think the html-unsafe is a better choice because gives you the possibility to apply sanitization per element rather than per application, let's see if someone else wants to add his own opinion while I finish the development. |
It would be really useful to have html-unsafe around. Though isn't bo-html is currently unsafe even with ngSantize? So maybe html-safe? |
Hi Pasvaz,
And then:
NaorYe |
Currently, we use a "safe" filter with bo-html, but you shouldn't need to do either. Unsafe html is only bad practice when it's user input. We use it for internationalization. That's hardly a fringe use case. |
Hi @naorye |
@Pasvaz, |
@naorye I see your point, however ng-bind-html-unsafe was present as core directive in the previous version of Angular and it's a common use case so I think we can mark it as not recomended in the readme and include it. |
@Pasvaz Sounds fine. |
Hi @naorye I'm working on this issue right now and I had the chance to dig into your plunker.
In this case, however, you cannot use this filter also for Also, The solution I'm going to push fixes both the use cases but it will not allow anymore unsafe html by default, so it'll be a breaking change. For this purpose it'll be available another directive, the above mentioned |
@Pasvaz You are right. Totally agreed. |
Hi, Could you suggest a workaround? Thanks! |
bo-html does nothing when using jQuery instead of jqLite. Here is a plunkr:
http://plnkr.co/edit/tjCvvxu2gG75m3WiSJAB?p=preview
Try to remove the reference to jQuery and everything will work.
Related issues:
#68
#39
The text was updated successfully, but these errors were encountered: