首页 > Angular.js动态加载html无法解析

Angular.js动态加载html无法解析

app.js:

$http.get(article.html).success(function(data) {
    $scope.content = data;
});

index.html:

<article>
    {{content}}
</article>

article.html:

<h1>Hello World</h1>

此时在浏览器中显示出的是<h1>Hello World</h1>而不是我希望的Hello World。

请问是为什么,如何解决?


$sce.trustAsHtml以前用这个也行


使用指令 ng-bind-html http://www.ngnice.com/docs/api/ng/directive/ngBindHtml

【热门文章】
【热门文章】