I am using $sce.trustAsHtml for bind the HTML code . Before i tried ng-bind-html alone but that not supporting the style(i.e, font color, size ). so i using $sce.trustAsHtml by two ways ,but even though it's not working
*1st way *
*HTML code*
<div class="email_quote" ng-bind-html="unsafe(emailData.message)">
JS code
$scope.unsafe = function(data)
{
return $sce.trustAsHtml(data);
}
*Error* on Console
1. Error: [$sce:itype]
http://errors.angularjs.org/1.2.23/$sce/itype?p0=html at Error (native)
at
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:6:450
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>
at trustAs (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:118:71
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at Object.e.(anonymous function) [as trustAsHtml] (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:120:339
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at k.$scope.updateView (
http://localhost:8080/app/ajs/components/apptivo/emails/app/scripts/controllers/emailSidePanelViewController.js:585:43
<http://localhost:8080/app/ajs/components/apptivo/emails/app/scripts/controllers/emailSidePanelViewController.js>)
at Object.fn (
http://localhost:8080/app/ajs/components/apptivo/emails/app/scripts/controllers/emailSidePanelViewController.js:589:24
<http://localhost:8080/app/ajs/components/apptivo/emails/app/scripts/controllers/emailSidePanelViewController.js>)
at k.$digest (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:109:403
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at k.$apply (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:112:398
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at h (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:72:454
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at v (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:77:463
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>
) angular.1.2.23.min.js:92
1. Error: [$rootScope:infdig]
http://errors.angularjs.org/1.2.23/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3…return%20m%3Da%7D%3B%20newVal%3A%20%7B%7D%3B%20oldVal%3A%20%7B%7D%22%5D%5D
<http://errors.angularjs.org/1.2.23/$rootScope/infdig?p0=10&p1=%5B%5B%22fn%3A%20function%20()%7Bvar%20a%3Dl(e)%3Bp(a%2CJ%5Bc%5D)%7C%7C(p(a%2Cm)%3Fn(e%2Ca%3DJ%5Bc%5D)%3AJ%5Bc%5D%3Da)%3Breturn%20m%3Da%7D%3B%20newVal%3A%20%7B%7D%3B%20oldVal%3A%20%7B%7D%22%5D%2C%5B%22fn%3A%20function%20()%7Bvar%20a%3Dl(e)%3Bp(a%2CJ%5Bc%5D)%7C%7C(p(a%2Cm)%3Fn(e%2Ca%3DJ%5Bc%5D)%3AJ%5Bc%5D%3Da)%3Breturn%20m%3Da%7D%3B%20newVal%3A%20%7B%7D%3B%20oldVal%3A%20%7B%7D%22%5D%2C%5B%22fn%3A%20function%20()%7Bvar%20a%3Dl(e)%3Bp(a%2CJ%5Bc%5D)%7C%7C(p(a%2Cm)%3Fn(e%2Ca%3DJ%5Bc%5D)%3AJ%5Bc%5D%3Da)%3Breturn%20m%3Da%7D%3B%20newVal%3A%20%7B%7D%3B%20oldVal%3A%20%7B%7D%22%5D%2C%5B%22fn%3A%20function%20()%7Bvar%20a%3Dl(e)%3Bp(a%2CJ%5Bc%5D)%7C%7C(p(a%2Cm)%3Fn(e%2Ca%3DJ%5Bc%5D)%3AJ%5Bc%5D%3Da)%3Breturn%20m%3Da%7D%3B%20newVal%3A%20%7B%7D%3B%20oldVal%3A%20%7B%7D%22%5D%2C%5B%22fn%3A%20function%20()%7Bvar%20a%3Dl(e)%3Bp(a%2CJ%5Bc%5D)%7C%7C(p(a%2Cm)%3Fn(e%2Ca%3DJ%5Bc%5D)%3AJ%5Bc%5D%3Da)%3Breturn%20m%3Da%7D%3B%20newVal%3A%20%7B%7D%3B%20oldVal%3A%20%7B%7D%22%5D%5D>
at Error (native) at
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:6:450
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>
at k.$digest (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:110:267
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at k.$apply (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:112:398
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at h (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:72:454
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at v (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:77:463
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at XMLHttpRequest.w.onreadystatechange (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:79:24
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>
) angular.1.2.23.min.js:92
1. Uncaught object
*2nd way *
It's working fine, but i have console error
*Js code *
$scope.emailData.message = $sce.trustAsHtml(emailData.message);
*HTML code *
<div class="email_quote" ng-bind-html="emailData.message">
*Error*
TypeError: undefined is not a function at z (
http://localhost:8080/app/ajs/common/scripts/common/angular-sanitize.min.js:7:350
<http://localhost:8080/app/ajs/common/scripts/common/angular-sanitize.min.js>)
at
http://localhost:8080/app/ajs/common/scripts/common/angular-sanitize.min.js:12:1
<http://localhost:8080/app/ajs/common/scripts/common/angular-sanitize.min.js>
at Object.fn (
http://localhost:8080/app/ajs/common/scripts/common/angular-sanitize.min.js:12:216
<http://localhost:8080/app/ajs/common/scripts/common/angular-sanitize.min.js>)
at k.$digest (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:109:403
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at k.$apply (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:112:398
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at h (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:72:454
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at v (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:77:463
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
at XMLHttpRequest.w.onreadystatechange (
http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js:79:24
<http://localhost:8080/app/ajs/common/scripts/common/angular.1.2.23.min.js>)
Please give the suggestion for above problem. any other way to handle this
problem
Thank you
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
