You must Sign In to post a response.
  • Category: ASP.Net MVC

    Dispaly data and html using angularjs in MVC


    Iam new to MVC and AngularJs. I want to display data from database in table Format.

    I have created employee table and connected using Entity frameworks Database First method.following is my working code.

    problem is it display the table header first and display records later.there is some seconds gap.

    Employee Controller

    public class EmployeeController : Controller
    ExerciseEntities1 Db = new ExerciseEntities1();

    // GET: /Employee/
    public ActionResult Index()
    return View();

    public JsonResult GetEmployee()
    var emp = Db.Employees.ToList();
    return Json(emp, JsonRequestBehavior.AllowGet);

    Model Class

    public partial class Employee
    public int Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Company { get; set; }


    <div ng-app="mvcapp" ng-controller="DemoController">
    <form name="myform">

    First Name

    <tr ng-repeat="empModel in employees">
    <td>{{empModel.FirstName }}</td>
    <td>{{empModel.LastName }}</td>



    input[type=button][disabled=disabled] {
    opacity: 0.65;
    cursor: not-allowed;

    table tr th {
    padding: 10px 30px;

    table tr td {
    padding: 10px 30px;

    <script src=""></script>
    <link rel="stylesheet" href="">
    <script src=""></script>
    var angular = angular.module('mvcapp', []);

    angular.controller('DemoController', function ($scope, $http) {

    $scope.isDisabledupdate = true;
    //Get All Employee
    function GetAllData() {
    $http.get('/Employee/GetEmployee').success(function (data) {

    $scope.employees = data;


    My requirement is to display HTML and Data during page load using ng-init in angular js

    How to solve this


  • #769245

    check your debugger window you can find error description

    Name : Dotnet Developer-2015
    Email Id :

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • Sign In to post your comments