Questions tagged [ngsanitize]

The `ngSanitize` module provides functionality to sanitize HTML.

See $sanitize for usage.

93 questions
3
votes
1 answer

How to properly escape special characters using ngSanitize?

I want to let user enter special characters such as "&" and then convert those to correct html when page is submitted. ex "&" => "&" I have read the examples and found ng-bind-html and $sce. It seems ng-bind-html is useless for my need as it will…
2
votes
1 answer

Angular translate useSanitizeValueStrategy does not work at all

I have a problem with angular translates useSanitizeValueStrategy. It does nothing regardless what configuration i use. I am using the async loader to load my translations. It is an ASP.net MVC web api project. Things I did to make it work…
Chris
  • 65
  • 6
2
votes
2 answers

ng-href showing unsafe:javascript error

I need some help to fix the ngSanatize; ng-href link is showing error unsafe:javascript... I did not get any tutorial to solve this problem, the code is below mention: ng-href="javascript:google.maps.event.trigger(gmarkers['{{city.cityname}}'] HTML…
2
votes
1 answer

Angular template compilation javascript

I have the controller that loads template from the server. Controller receives the template by http and compiles it to the valid html. All is fine but js-calls. My template contains href's/buttons with href-javascript/onclick actions. Here is…
Globber
  • 575
  • 3
  • 14
2
votes
1 answer

ng-bind-html with ng-sanitize' linky output tags as strings

If I try to use both ng-sanitize's linky filter with ng-bind-html directive, it will transform initial string Well, this is bold, but this should become link http://www.example.com Lets test it! to one having link transformed to html link,…
kaytrance
  • 2,657
  • 4
  • 30
  • 49
2
votes
0 answers

Explain why this doesn't work? Removing dependency in angular breaks app

I've been working on some boilerplate stuff and ran into something peculiar. I have a module and it works fine: define([ 'angular', 'angular-couch-potato', 'angular-sanitize', 'angular-ui-router', ], function (ng, couchPotato) { …
Jason Spick
  • 6,028
  • 13
  • 40
  • 59
2
votes
2 answers

HTML encoded String not translating correctly in AngularJS

I have an HTML encoded string like this: Sign up and get <span class="strong">Something for FREE!</span> When I use ngSanitize and ng-bind-html in my template like this:

I get back the HTML…
Sev
  • 15,401
  • 9
  • 56
  • 75
2
votes
1 answer

ngSantize not working correctly with ng-bind-html

ngSantize not working right now,
    is blank when there should be content in there. When you open Dynamic Group Header - 2 it should say Dynamic Group Body - 2 But it's blank. What am I doing wrong…
    Agent Zebra
    • 4,410
    • 6
    • 33
    • 66
    2
    votes
    1 answer

    Does Angularjs automatically sanitize all data before rendering to dom?

    Does Angular sanitize all data when it gets rendered in the DOM automatically? ie, would this be safe: // using 'ngSanitize' angular.module('app', ['ngSanitize']); // somewhere in controller $http.get('/data').success(function(userdata) { …
    rublex
    • 1,893
    • 5
    • 27
    • 45
    2
    votes
    1 answer

    AngularJS: ngBindHtml that also contains child bindings?

    AngularJS v1.3.14: Currently, I'm successfully using the 'ngSanitize' module in my angular app with "ng-bind-html" to bind some HTML to the output of an area on the page. That works and doesn't require the older $sce 'trust HTML' stuff. But, I'd…
    Eric Swanson
    • 429
    • 5
    • 9
    2
    votes
    0 answers

    angularjs ng-bind-html with html character entities

    var text1 = "sometext"; var text2 = "<b>sometext</b>"; ng-bind-html="text1" works fine. The result is sometext but ng-bind-html="text2" doesn't work. The result is sometext How can I makeng-bind-html="text2"…
    monad98
    • 291
    • 4
    • 15
    2
    votes
    2 answers

    Using ngSanitize to allow some html tags

    I have an insecure string from the user that I want to display. I want a few html-tags like < strong > (without spaces) to work. All other html should be displayed like it was typed in (that is < should be replace with & lt; and so on) I'm pretty…
    Martin
    • 5,197
    • 11
    • 45
    • 60
    2
    votes
    1 answer

    AngularJS ngSanitize and SCE

    I am trying to understand how $sce and ngSanitize work so I can utilize it properly, please bare with a few questions I have for clarifications. I couldn't get enough details from the documentation. First of all, what I understand $sce provides an…
    iQ.
    • 3,811
    • 6
    • 38
    • 57
    1
    vote
    1 answer

    AngularJs sanitizing and displaying html

    I am trying to display dynamically html inside a div. However the div ng-bind-html does not display at all (on firefox, chrome and safari). Looking at the other posts of this website I saw that I have to include ngSanitize. I found this snippet here…
    1
    vote
    1 answer

    How to safely bind HTML from Model to View

    Show html code as html code if all text and styles are saved on api Let's say i'm using a text editor and i save on an api not only the text, but the html styles too (ex. ,

    , blabla). What i want is to show the text on my html view, but…