front end display data frmo database nodejs html code example

Example: front end display data frmo database nodejs html

<!doctype html>
<html ng-app>
  <head>
    <title>My AngularJS App</title>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script>
  </head>
  <body>
  <div ng-controller="MyCtrl">
    <table>
      <thead>
        <tr>
          <th>
            <p>Name</p>
          </th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="user in users">
          <td> 
            <p>{{user}}</p>
          </td>
        </tr>
      </tbody>
    </table>
   </div>
    <script>
     var myApp = angular.module('myApp',[]);
     function MyCtrl($scope, $http) {
     //This method will call your server, with the GET method and the url /show
     $http.get("http://localhost:3000/show").then(function(success){
      if(success.data.length>0)
      {
         $scope.users=success.data;
      }
     });
     }
   </script>
  </body>
 </html>

Tags:

Misc Example