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如何命令行開啟呢?2. 為什么我ping不通我的docker容器呢???3. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題4. docker容器呢SSH為什么連不通呢?5. nignx - docker內(nèi)nginx 80端口被占用6. 關(guān)docker hub上有些鏡像的tag被標記““This image has vulnerabilities””7. angular.js使用$resource服務把數(shù)據(jù)存入mongodb的問題。8. docker gitlab 如何git clone?9. docker 下面創(chuàng)建的IMAGE 他們的 ID 一樣?這個是怎么回事????10. docker-compose 為何找不到配置文件?

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