我想在另一个指令tempalte中添加动态指令。 正如你看到的我想添加其他指令一条指令模板 里面如何添加这些动态指令有在AngularJS的另一个指令模板中添加一个动态指令
请帮
return {
restrict: 'AE',
require :'^awkGrid',
templateUrl: 'views/shutter.html',
link : function(scope, element, attr, controllerInstance){
//Set the header
scope.items = [];
angular.forEach(scope.rowData, function(value, key) {
var obj = {
key : key,
value : value
};
template = <country name="'+value.country+'" id="'+key+'"></country>;
scope.items.push(template);
});
};
//Inside shutter.html file
<div data-ng-repeat="item in items" class="ag-row action-row"
ng-class-odd="'ag-row-even'"
ng-class-even="'ag-row-odd'"
ng-class="{'ag-row-selected':$index == selectedRow}"
ng-click="setClickedRow($index,$event)">
<div class="ag-cell">
{{item}} //Not working ,Prinitng the string
<country name="india" id="-1"></country> //Working
</div>
无法正常工作仍在显示 as string –
你可以把你的解决方案放到jsfiddle.net上吗? – Niezborala
恐怕是不可能的 –