我有一個表格materials
,當我點擊時,我想要顯示與該行有關的所有數據的表格。什麼是最好的方法來做到這一點?AngularJS - 從表格行顯示錶格
你可以看到下面
的index.html
<section ng-controller="materialController as materialCtrl">
<table class="table table-hover">
<th> Nombre </th>
<th> Descripción </th>
<tr ng-repeat="material in materials" ng-click="materialCtrl.openForm()">
<td>
{{material.name}}
</td>
<td>
{{material.description}}
</td>
</tr>
</table>
</section>
控制器
app.controller("materialController", ["$scope", "$http", function($scope, $http){
$http.get('material').success(function(data){
$scope.materials = data;
});
this.openForm = function(){
// Do something
};
}]);
爲什麼我有-1? – 2014-09-01 16:00:05