Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to building a table using angular ?

    • 0
    • 3
    • 2
    • 2
    • 0
    • 0
    • 0
    • 0
    • 287
    Comment on it

    The ngRepeat directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop variable is set to the current collection item, and $index is set to the item index or key -angularJS

    The ng-repeat directive is perfect for displaying tables and its very simple -

    <html ng-app="countryApp">
      <head>
        <meta charset="utf-8">
        <title>Angular.js Example</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.1/angular.min.js"></script>
        <script>
          var countryApp = angular.module('countryApp', []);
          countryApp.controller('CountryCtrl', function ($scope){
            $scope.countries = [
              {"name": "China", "population": 1359821000},
              {"name": "India", "population": 1205625000},
              {"name": "United States of America","population": 312247000}
            ];
          });
        </script>
      </head>
      <body ng-controller="CountryCtrl">
        <table>
          <tr>
            <th>Country</th>
            <th>Population</th>
          </tr>
          <tr ng-repeat="country in countries">
            <td>{{country.name}}</td>
            <td>{{country.population}}</td>
          </tr>
        </table>
      </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: