Routing
.when('/student/:Id', {
templateUrl: 'student/index',
controller: 'studentEditCtrl'
})
my link contains
<a class="btn btn-primary" ng-href="#/student/@v.Id">Edit</a>
my Angular controller
angular.module('newApp')
.controller('studentEditCtrl', ['$scope', function ($scope, $stateParams) {
$scope.isTabActive = true;
$scope.Id = $stateParams.Id;
alert("studentEditCtrl");
}]);
I have also used $routeParams instead $stateParams.
My MVC Controller
public ActionResult Index(int? Id)
{
Student st = new Student();
if (Id != null)
st = sRepository.Students.FirstOrDefault(c => c.Id == Id);
return View(st);
}
In Asp.net MVC Controller Id is always Null,