我知道我错过了一些我无法弄清楚的事情。需要你帮助的人。 基本上我想创建多个缩略图,为此,我将数据存储在变量中,然后尝试重复以获取详细信息,但没有成功。请帮忙。这是相同的plunker。没有指令,使用ng-include,它的工作正常,但有指令,没有任何东西显示出来。
指令代码: -
app.directive('thumbnail', function() {
return {
restrict: 'E',
templateUrl: 'UI/templates/thumbnail.html',
scope: {
}
}
});
答案 0 :(得分:0)
app.directive('thumbnail', function() {
return {
restrict: 'AE',
templateUrl: 'UI/templates/thumbnail.html',
}
});
答案 1 :(得分:0)
app.directive('thumbnail', function() {
return {
restrict: 'AE',
templateUrl: 'UI/templates/thumbnail.html',
}
});
删除隔离范围,将使控制器中定义的数据在指令中可用。如果您仍想使用隔离范围,请使用=运算符
传递数据答案 2 :(得分:0)
使用指令更新了plunker。
[https://plnkr.co/edit/Yr8DsPb3kt5Jz3CNFGnM?p=preview][1]