Маршрутизация
.when('/student/:Id', {
templateUrl: 'student/index',
controller: 'studentEditCtrl'
})
моя ссылка содержит
<a class="btn btn-primary" ng-href="#/student/@v.Id">Edit</a>
мой угловой контроллер
angular.module('newApp')
.controller('studentEditCtrl', ['$scope', function ($scope, $stateParams) {
$scope.isTabActive = true;
$scope.Id = $stateParams.Id;
alert("studentEditCtrl");
}]);
Я также использовал $routeParams вместо $stateParams.
Мой MVC-контроллер
public ActionResult Index(int? Id)
{
Student st = new Student();
if (Id != null)
st = sRepository.Students.FirstOrDefault(c => c.Id == Id);
return View(st);
}
В Asp.net MVC Controller Id всегда равен Null,