AngularJS: ng-repeat not printing data coming from asp.net mvc action
-
Hi i am learning angularjs.i am using AngularJs version v1.8.2 and VS2013 IDE. i am trying to call asp.net mvc action from angularjs controller and print data in page by ng-repeater. ng-repeater not printing any data. This is my asp.net mvc action
public ActionResult GetData(string p1)
{
List crs = new List();
crs.Add(new course { Name = "C#" });
crs.Add(new course { Name = "VB.Net" });
crs.Add(new course { Name = "SQL" });
crs.Add(new course { Name = "RDBMS" });
return Json(crs, JsonRequestBehavior.AllowGet);
}This is my angularjs controller from where i am calling asp.net mvc action.
var myApp = angular.module("MyApp", []);
myApp.controller('myController', function ($scope, $http) {
$scope.Update = function (p1) {
$http({
url: '/Home/GetData?p1='+p1,
method: 'GET'
})
.then(function (response) {
console.log(response.data);
//alert(response.data.Data)
$scope.Courses = response.data;
});
};
});This way i am printing data by ng-repeater
Input :
{{Courses}}
List of Courses
* {{course.Name}}
{{Courses}}
This is showing data i am getting from action. console.log() also showing data. please suggest me which area i need to fix in my code as a result ng-repater should work. Thanks