我试图在元素中放置一些角度js模板字符串,并期望一个符合输出.但那并没有发生.
HTML
<div ng-controller="testController">
<div ng-bind-html-unsafe="fruitsView"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
控制器:
function filterController($scope){
...
$scope.arr = ["APPLE", "BANANA"];
$scope.fruitsView = '<div><p ng-repeat="each in arr">{{each}}</p></div>';
}
Run Code Online (Sandbox Code Playgroud)
输出就是{{each}}.
那么如何$scope.fruitsView在元素中插入角度js模板字符串(此处)?
我为此做了一个小提琴.
angularjs ×1