angularJS實現(xiàn)表格部分列展開縮起示例代碼
AngularJS 簡介
AngularJS 是一個 JavaScript 框架。它可通過 <script> 標簽添加到 HTML 頁面。
AngularJS 通過 指令 擴展了 HTML,且通過 表達式 綁定數(shù)據(jù)到 HTML。
AngularJS 是一個 JavaScript 框架
AngularJS 是一個 JavaScript 框架。它是一個以 JavaScript 編寫的庫。
AngularJS 是以一個 JavaScript 文件形式發(fā)布的,可通過 script 標簽添加到網(wǎng)頁中:
<script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>
下面看下angularJS實現(xiàn)表格部分列展開縮起示例代碼,效果圖如下所示:
<html> <head> <title> New Document </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script> <!-- <script src='https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js'></script>--> <style type="text/css"> table, tr, td, caption{ border:1px solid #666; border-collapse:collapse; background-color:rgb(210, 219, 236); } td, caption{ /*font-family:'微軟雅黑';*/ font-family: "Fira Code Light"; font-size:12px; text-align:center; padding:3px 15px; } caption{ border-bottom:none; cursor:pointer; } </style> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { //默認縮起 $scope.myVar = true //顯示隱藏按鈕 $scope.openClose = function () { $scope.myVar = !$scope.myVar; $scope.myVar1 = !$scope.myVar1; }; }); </script> </head> <body> <table ng-app="myApp" ng-controller="myCtrl"> <caption ng-click="openClose()">顯示/隱藏價格</caption> <tr> <td >產(chǎn)品</td> <td ng-hide = 'myVar1' ng-click="openClose()">...</td> <td ng-hide = 'myVar'>價格</td> <td ng-hide = 'myVar'>價格</td> <td ng-hide = 'myVar'>價格</td> <td ng-hide = 'myVar'>價格</td> <td >銷量</td> </tr> <tr> <td>A</td> <td ng-hide = 'myVar1'>...</td> <td ng-hide = 'myVar'>18元</td> <td ng-hide = 'myVar'>28元</td> <td ng-hide = 'myVar'>38元</td> <td ng-hide = 'myVar'>48元</td> <td>2</td> </tr> <tr> <td>B</td> <td ng-hide = 'myVar1'>...</td> <td ng-hide = 'myVar'>77元</td> <td ng-hide = 'myVar'>88元</td> <td ng-hide = 'myVar'>88元</td> <td ng-hide = 'myVar'>88元</td> <td>3</td> </tr> <tr> <td>C</td> <td ng-hide = 'myVar1'>...</td> <td ng-hide = 'myVar'>66元</td> <td ng-hide = 'myVar'>88元</td> <td ng-hide = 'myVar'>88元</td> <td ng-hide = 'myVar'>88元</td> <td>4</td> </tr> </table> </body> </html>
到此這篇關(guān)于angularJS實現(xiàn)表格部分列展開縮起示例代碼的文章就介紹到這了,更多相關(guān)angularJS表格展開縮起內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
AngularJS教程之MVC體系結(jié)構(gòu)詳解
本文主要講解AngularJS MVC體系結(jié)構(gòu),這里提供詳細的教程供大家學(xué)習(xí)參考,有需要的小伙伴可以參考下2016-08-08AngularJS 在同一個界面啟動多個ng-app應(yīng)用模塊詳解
這篇文章主要介紹了AngularJS 在同一個界面啟動多個ng-app應(yīng)用模塊詳解的相關(guān)資料,需要的朋友可以參考下2016-12-12Angular ui.bootstrap.pagination分頁
這篇文章主要為大家詳細介紹了Angular ui.bootstrap.pagination 分頁的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01詳解如何使用webpack+es6開發(fā)angular1.x
本篇文章主要介紹了詳解如何使用webpack+es6開發(fā)angular1.x,具有一定的參考價值,有興趣的可以了解一下2017-08-08Angular?Ngrx?Store應(yīng)用程序狀態(tài)典型示例詳解
這篇文章主要為大家介紹了Angular?Ngrx?Store應(yīng)用程序狀態(tài)典型示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-07-07angularJs提交文本框數(shù)據(jù)到后臺的方法
今天小編就為大家分享一篇angularJs提交文本框數(shù)據(jù)到后臺的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-10-10