【发布时间】:2015-02-18 19:34:18
【问题描述】:
我正在尝试在元素模板中获取代码:
rent.html
<td>{{ rent.id }}</td>
<td>{{ rent.auto }}</td>
<td>{{ rent.person }}</td>
<td>{{ rent.title }}</td>
<td>{{ rent.start }}</td>
<td>{{ rent.end }}</td>
<td><a ng-href="#" ng-click="acceptRent(rent.id)"><img src="bundles/chriskfzbuchung/images/accept.png" width="15" ng-hide="rent.buchungsStatus == 1"></a></td>
<td><a ng-href="#" ng-click="declineRent(rent.id)"><img src="bundles/chriskfzbuchung/images/decline.png" width="15" ng-hide="rent.buchungsStatus == 2"></a></td>
controller.js
kfzModule.directive("kfzRent", function(){
return {
restrict: 'E',
templateUrl: '/kfz-buchung/rent.html'
};
});
overview.html
<tr kfz-rent ng-repeat="rent in rents" ng-class="{'success' : rent.buchungsStatus == 1, 'danger' : rent.buchungsStatus == 2}">
</tr>
我不知道如何处理overview.html中的其余部分。
我终于想要一个<kfz-rent></kfz-rent>。
谢谢!
【问题讨论】:
-
我有点困惑你想要什么?
-
我不想在overview.html中有ng-repeat和ng-class指令,overview.html应该只有
-
把overview.html中除了kfz-rent属性之外的所有内容放到rent.html中
-
不适用于
元素(我在rent.html 中使用了 ) 我也没有 javascript 错误
标签: javascript html angularjs templates directive