溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

Bootstrap + AngularJS怎么實現(xiàn)數(shù)據(jù)過濾字符查找功能

發(fā)布時間:2021-05-21 14:03:33 來源:億速云 閱讀:135 作者:小新 欄目:web開發(fā)

這篇文章主要介紹Bootstrap + AngularJS怎么實現(xiàn)數(shù)據(jù)過濾字符查找功能,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

 具體代碼如下所示:

find.html

<!DOCTYPE html> 
<html ng-app="find"> 
<head> 
<title>字符查找</title> 
<meta charset="utf-8"/>  
<script src="../Script/angular.min.js" type="text/javascript"></script> 
<link rel="stylesheet" href="../bootstrap-3.0.0/css/bootstrap.css" rel="external nofollow" > 
<style type="text/css"> 
 body{ 
    font-size: 12px; 
 } 
 ul{ 
  list-style-type: none; 
  width: 408px; 
  margin:0px; 
  padding: 0px; 
 } 
 ul li { 
     float: left; 
     padding: 5px 0px; 
 } 
 ul .bold { 
      font-weight: bold; 
      cursor: pointer; 
 } 
 ul li span { 
       width: 70px; 
       float: left; 
       padding: 0px 10px; 
 } 
 ul .focus { 
       background-color: #cccccc; 
 } 
</style> 
<script type="text/javascript"> 
    var find = angular.module('find', []); 
    find.controller('find_name', ['$scope', function ($scope) { 
      $scope.bold = "bold"; 
      $scope.key = ''; 
      $scope.data = [ 
      { name: "張小琴", sex: "女", age: 24, score: 95 }, 
      { name: "李清思", sex: "女", age: 27, score: 87 }, 
      { name: "楊旭旭", sex: "男", age: 28, score: 86 }, 
      { name: "陳楚圣", sex: "男", age: 23, score: 97 } 
      ]; 
    }]) 
 </script> 
</head> 
<body> 
  <div ng-controller="find_name" align="center"> 
   <div class="panel panel-primary" align="center" > 
     <div class="panel-heading" align="center"> 
      <div class="panel-title" >字符查找</div> 
     </div> 
    <div> 
      <input id="txtkey" type="text" ng-model="key"  
        placeholder="請輸入姓名關(guān)鍵字" /> 
    </div> 
    <ul> 
      <li ng-class="{{bold}}" > 
        <span>序號</span> 
        <span>姓名</span> 
        <span>性別</span> 
        <span>年齡</span> 
        <span>分數(shù)</span> 
      </li> 
      <li ng-repeat=" stu in data | filter : {name:key}" > 
        <span>{{$index+1}}</span> 
        <span>{{stu.name}}</span> 
        <span>{{stu.sex}}</span> 
        <span>{{stu.age}}</span> 
        <span>{{stu.score}}</span> 
      </li> 
    </ul> 
  </div> 
 </div> 
</body> 
</html>

截圖:

Bootstrap + AngularJS怎么實現(xiàn)數(shù)據(jù)過濾字符查找功能

Bootstrap + AngularJS怎么實現(xiàn)數(shù)據(jù)過濾字符查找功能

Bootstrap是什么

Bootstrap是目前最受歡迎的前端框架,它是基于 HTML、CSS、JAVASCRIPT 的,它簡潔靈活,使得 Web 開發(fā)更加快捷,它還有一個響應(yīng)最好的Grid系統(tǒng),并且能夠在手機端通用,而Bootstrap是使用許多可重用的CSS和JavaScript組件,可以幫助實現(xiàn)需要的幾乎任何類型的網(wǎng)站的功能,此外,所有這些組件都是響應(yīng)式的。

以上是“Bootstrap + AngularJS怎么實現(xiàn)數(shù)據(jù)過濾字符查找功能”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI