Click here to Skip to main content
15,899,475 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to display model in my view but i am not geting out put? kindly help

What I have tried:

JavaScript
/// <reference path="scripts/angular.min.js" />

var app = angular.module("my", []).controller("co", function ($scope) {

    var emp = [
        { firstname: "ben", seconedname: "gupta" },
        { firstname:"Vikrant",seconedname:"gupta"  }
    ];

    $scope.emp = emp;

});




HTML
<!DOCTYPE html>
<html>
<head>
    <script src="scripts/angular.min.js"></script>
    <script src="scripts/userdefine.js"></script>

    <title></title>
</head>
<body  ng-app = "">
<div ng-controller ="co">
  <table>
      <thead>
          <tr>
              <th>
                  First name
              </th>
              <th>
                  Seconed name
              </th>


          </tr>
      </thead>
      <tbody>
          <tr ng-repeat ="emp1 in emp">
              <td>
                  {{emp1.firstname}}
                  
              </td>
              <td>
                   {{emp1.firstname}}
              </td>
          </tr>
      </tbody>
  </table>
</div>
</body>
</html>
Posted
Updated 7-Feb-17 19:48pm

1 solution

You need to change one thing and it will work like magic.
You must specify module name in the view in ng-app attribute.

<body  ng-app = "my">
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900