Angular Tutorial 2

In this example below you will see how to do a Angular Tutorial 2 with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by razvan-tudosa, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright razvan-tudosa ©

Technologies

  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Angular Tutorial 2</title>
  
  
  
  
  
</head>

<body>

  <div ng-app="myApp">
  <div ng-controller="dbCtrl" >
    <table>
      <input type="text" ng-model="search.name" />
      <tr ng-repeat="obj in db.test | orderBy:'-name' | limitTo:2 | filter:search">
        <td>{{obj.name}}:</td>
        <td>{{obj.age}}</td>
      </tr>
    </table>
  </div>
  
</div>
  <script src='https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/razvan-tudosa/angular-tutorial-2-Eglzo */
var myApp = angular.module('myApp', []);

myApp.factory('db', function() {
  var db = {};
  
  db.test = [
    {
      name: "Bob",
      age: "20"
    },
    {
      name: "Alex",
      age: "21"
    },
    {
      name: "Zack",
      age: "23"
    },
    {
      name: "Mark",
      age: "24"
    },
  ];
  
  return db;
});
    
function dbCtrl($scope, db) {
    $scope.db = db;
};

Comments