How to bind a List in Angular js in mvc
1951
28-Dec-2015
I want to bind a List in Angular js in mvc .how to do this Please help me.
Updated on 28-Dec-2015
Anonymous User
28-Dec-2015@{ ViewBag.Title = "Country"; Layout = "~/Views/Shared/_Dashboard.cshtml"; } <script src="/Scripts/angular.js" type="text/javascript"></script> <script src="/Scripts/Country.js" type="text/javascript"></script> <script language="javascript"> var App = angular.module('Country', []); App.controller('CountryControler', Viewmodel); </script> <div data-ng-app="Country"> <div class="box ui-draggable ui-droppable" data-ng-controller="CountryControler"> <div class="box-header"> <div class="box-name"> <i class="fa fa-search"></i><span>Country List form</span> </div> <div class="box-icons"> <a class="collapse-link"><i class="fa fa-chevron-up"></i></a><a class="expand-link"> <i class="fa fa-expand"></i></a><a class="close-link"><i class="fa fa-times"></i> </a> </div> <div class="no-move"> </div> </div> <div class="box-content"> <table class="table table-striped table-bordered table-hover table-heading no-border-bottom"> <thead> <tr> <th> Id </th> <th> Country name </th> <th> Country Code </th> <th> Action </th> </tr> </thead> <tbody> <tr data-ng-repeat="item in Countrys"> <td> {{item.countryId}} </td> <td> {{item.countryName}} </td> <td> {{item.countryCode}} </td> <td> <button data-ng-click="Modify(item)"> Edit</button> </td> </tr> </tbody> </table> </div> </div> </div> country.jsvar Viewmodel = function ($scope, $http) { $scope.Load = function () { $http.post('/Location/GetCountrys'). success(function (data, status, headers, config) { $scope.Countrys = data; }). error(function (data, status, headers, config) { }); } $scope.Load(); }