Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Angularjs从rss渲染博客_Javascript_Angularjs_Angularjs Scope - Fatal编程技术网

Javascript 使用Angularjs从rss渲染博客

Javascript 使用Angularjs从rss渲染博客,javascript,angularjs,angularjs-scope,Javascript,Angularjs,Angularjs Scope,我正试图找到最好的方式来打印我的文章在我的网站上使用Angularjs。我是从你那儿得到这个职位的。我有一大堆代码、清单等。。你可以从中看到。所以我获取Json并将其正确发送到视图,您可以看到以下代码: myController.controller('BlogCtrl', ['$scope', '$http', function ($scope, $http) { $http.get('http://pipes.yahoo.com/pipes/pipe.run?_id=31e003

我正试图找到最好的方式来打印我的文章在我的网站上使用Angularjs。我是从你那儿得到这个职位的。我有一大堆代码、清单等。。你可以从中看到。所以我获取Json并将其正确发送到视图,您可以看到以下代码:

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;
      });
  }]);
我遇到的第一个问题是,当我试图打印{{post.content}}时,它没有呈现html,我发现它可以呈现代码

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

但这对我不起作用。也应该是一个简单的方式或库直接打印代码,我的意思是像在网站上的代码块


谢谢

如果要呈现HTML,需要包含模块:

之后,您将能够安全地呈现HTML内容

演示:

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