1

I'm trying to find the best way to print my posts in my website using Angularjs. I get the post from here. I have bloque of codes, list, etc.. you can see from here. So.. I get the Json and I send it propely to the view, you can see the code below:

myController.controller('BlogCtrl', ['$scope', '$http',
  function ($scope, $http) {
    $http.get('http://pipes.yahoo.com/pipes/pipe.run?_id=31e0037a4869eeb55f58c22114816864&_render=json')
        .success(function(data){
      $scope.posts = data.value.items;
    }).
        error(function() {
        $scope.error = true;
      });
  }]);

First problem I got is when I try to print the {{post.content}} doesn´t render the html, I found this to render the code

<div ng-bind-html="expression"></div>

but it´s not working for me. Also should be a easy way or a library to print the code directly, I mean the bloque of code like in the website.

Thanks.

1 Answer 1

1

If you want to render HTML, you need to include ngSanitize module:

angular.module('myController', ['ngSanitize']);

After that you will be able to safely render HTML contents.

Demo: http://plnkr.co/edit/6V8TtmUUhYecQoF66wAj?p=info

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.