showing results for - "front end display data frmo database nodejs html"
Dolly
17 Nov 2019
1<!doctype html>
2<html ng-app>
3  <head>
4    <title>My AngularJS App</title>
5    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
6  </head>
7  <body>
8  <div ng-controller="MyCtrl">
9    <table>
10      <thead>
11        <tr>
12          <th>
13            <p>Name</p>
14          </th>
15        </tr>
16      </thead>
17      <tbody>
18        <tr ng-repeat="user in users">
19          <td> 
20            <p>{{user}}</p>
21          </td>
22        </tr>
23      </tbody>
24    </table>
25   </div>
26    <script>
27     var myApp = angular.module('myApp',[]);
28     function MyCtrl($scope, $http) {
29     //This method will call your server, with the GET method and the url /show
30     $http.get("http://localhost:3000/show").then(function(success){
31      if(success.data.length>0)
32      {
33         $scope.users=success.data;
34      }
35     });
36     }
37   </script>
38  </body>
39 </html>
40