我有这个javascript代码:
app.controller('Ctrl',[ '$scope', function ($scope){
$scope.poems =[
{title:"title1", author:"author1", file:"URLfile1"},
{title:"title2", author:"author2", file:"URLfile2"},
{title:"title3", author:"author3", file:"URLfile3"}
];
}]);
进入html我想做类似的事情:
<div ng-repeat ="poem in poems">
<h1>{{poem.title}}</h1>
<p>{{poem.author}}</p>
<div ng-include="{{poem.file}}"></div>
</div>
但这似乎不起作用。 你有什么建议吗?
答案 0 :(得分:0)
然后你可以试试这个
<div ng-include src="{{poem.file}}"></div>
这可能会奏效。
答案 1 :(得分:0)
解决方案是
<div ng-include src="poem.file"></div>
没有括号