-2

Below code is not working for parameter passing

   <li class="active" ng-disabled="disabledAction"><a href="#!/Reservation/821" ><i class="fa fa-fw fa-pencil-square-o icon-push"></i>{{langResources.EditReservation}}</a></li>

when click this link will redirecto below controller.but not getting parameter value ie,821

 [HttpGet]
    public ActionResult HotelReservation(long resId = 0)
    {
        ViewBag.resId = resId;
        return PartialView();
    }

 $routeProvider.when('/Reservation/:ResId', {
    templateUrl: '/Home/HotelReservation/resId=ResId',
    controller: 'HotelReservationCtrl',
activetab: 'Reservation'
});
safeena rasak
  • 390
  • 2
  • 5
  • 16

2 Answers2

0

I think you have to change the when part with ? $routeProvider.when('/Reservation/:ResId?', { templateUrl: '/Home/HotelReservation/resId=ResId', controller: 'HotelReservationCtrl', activetab: 'Reservation' });. As it is expecting resId parameter value in your MVC controller. So in anchor tag do this <a href="#!/Reservation?resId=821" >

Namdeo Karande
  • 403
  • 1
  • 3
  • 19
0

Now it is working.

code change to

 $routeProvider.when('/Reservation/:ResId', {
templateUrl: function (params) {
        var url='/Home/HotelReservation?resId=' + params.ResId;
         return url},    
controller: 'HotelReservationCtrl',
activetab: 'Reservation'
});
safeena rasak
  • 390
  • 2
  • 5
  • 16