doufuhao0566 2015-05-14 11:23 采纳率: 100%
浏览 53

使用AngularJS $ http显示来自Mysql数据库的特定学生记录

I have this table in mysql database

enter image description here

When a student enter his rollno in input field it should display his record. enter image description here


Its my code

<div class="col-sm-3">

<input type="text" ng-model="filterTask" class="form-control search header-elements-margin" placeholder="Enter your rollno">

</div>
</div></div>
<div class="widget-body ">

<div class="task">
 <div ng-class="{strike:task.STATUS==2}" style="font-weight:bold;"><span>ID </span> <span> Name </span> <span> Class </span> <span> Father </span> <span> Teacher</span></div>
    <label class="checkbox" ng-repeat="task in tasks | filter : filterTask">

    <div ng-class="{strike:task.STATUS==2}"><span>{{task.id}} </span> <span> {{task.name}} </span> <span> {{task.class}} </span> <span> {{task.father}} </span> <span> {{task.teacher}}</span></div>

    </label>
</div>

<script>
    //Define an angular module for our app
var app = angular.module('myApp', []);

app.controller('studentController', function($scope, $http) {
  getTask(); // Load all available tasks 
  function getTask(){  
  $http.post("getStudents.php").success(function(data){
        $scope.tasks = data;
       });
  };
});
    </script>

It is displaying all records, but I need to show a specific result when a rollno entered. It is like a filter, but I want to get specific student result when enter his rollno.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿
    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?