angular.js - angular如何實現(xiàn)一個界面兩個table模塊并存呢?
問題描述
如圖:
上下兩個都是數(shù)據(jù)表,如何實現(xiàn)呢?
問題解答
回答1:給你個小例子玩玩看:jsfiddle
<p ng-controller='DemoCtrl'> <table border='1'> <tr ng-repeat='item in table1' ng-click='showDetail(item)'> <td>{{ item.id }}</td> <td>{{ item.name }}</td> <td>{{ item.age }}</td> </tr> </table> <table border='1'> <tr ng-repeat='item in table2'> <td>{{ item.address }}</td> <td>{{ item.email }}</td> </tr> </table></p>
demo.controller(’DemoCtrl’, function($scope){ $scope.table2 = [];$scope.table1 = [{ id: 1, name: ’Hanmeimei’, age: 31, detail: [{address: ’Zhongguo’,email: ’Hmm@sohu.com’ }]},{ id: 2, name: ’Lilei’, age: 32, detail: [{address: ’Yindu’,email: ’Ll@gmail.com’ }]} ];$scope.showDetail = function(item){$scope.table2.length = 0;Array.prototype.push.apply($scope.table2, item.detail); };});
相關(guān)文章:
1. mac連接阿里云docker集群,已經(jīng)卡了2天了,求問?2. docker網(wǎng)絡(luò)端口映射,沒有方便點的操作方法么?3. debian - docker依賴的aufs-tools源碼哪里可以找到啊?4. 百度地圖api - Android 百度地圖 集成了定位,導(dǎo)航 相互的jar包有沖突?5. vim - docker中新的ubuntu12.04鏡像,運行vi提示,找不到命名.6. 為什么我ping不通我的docker容器呢???7. angular.js - angular內(nèi)容過長展開收起效果8. html5和Flash對抗是什么情況?9. golang - 用IDE看docker源碼時的小問題10. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?

網(wǎng)公網(wǎng)安備