javascript

I have a little problem with my angularJS code, I’m trying to display json that contain css and html code. All that display on my website is a hardcode form html+css(it looks like the code below), i tired to use an ng-bind-html/ng-bind-html-unsafe, but it only displays html, and css code just dispensary. The easiest way would be convert displayed text to a code, but i don’t have any idea to do this.

@HTMLAtSo: AngularJs doesn’t display css

I have a little problem with my angularJS code, I’m trying to display json that contain css and html code. All that display on my website is a hardcode form html+css(it looks like the code below), i tired to use an ng-bind-html/ng-bind-html-unsafe, but it only displays html, and css code just dispensary. The easiest way would be convert displayed text to a code, but i don’t have any idea to do this.

You can use angularjs $compile service and do something like this in the controller-

First add a dependency to $compile in your controller and write below code

It is not a best practice to do DOM manipulation in controller though and instead you can create a directive to do this.

What is the original connection between “nurse” and “sister”?

javascript