【发布时间】:2017-12-26 18:02:39
【问题描述】:
我为我的指令 template.html 编写模板:
<ul><span>{{name}}</span>
<li ng-repeat="value in values">
</ul>
Plug 指令如:
app.directive('myDir', function(){
return{
restrict: 'A',
templateUrl: 'template.html'
};
});
我有一些 js 对象看起来像:
const myObj:{
name:"MyObjName",
values:["val1","val2","val3","val4"]
}
请告诉我,我怎样才能将我的对象发送到我的模板,以便它像我想要的那样呈现指令?
在 index html 中,它看起来像 <div my-dir="{{myObj}}"></div>
【问题讨论】:
标签: javascript html angularjs angularjs-directive