0

I have an angularjs controller which i wanted to pass data to other angularjs controller, and here i am not using angularjs routing, only using MVC routing, As i am using MVC Routing, i had passed data from angularjs controller to MVC controller action method, and from there i have to return to another angularjs controller, i am unable to pass data to the other controller or even it is not returning to the MVC routed View(), and in angularjs controller i used $window.location.href to rediect to the expected view, But unablt to pass data

AngularJS Controller

 $http.post(attserviceBasePath + '/Dashboard/PostMembers', group)
                .then(
               function (response) {

                      window.location.href = attserviceBasePath + '/Attendance/Dashboard/GroupedTeamMembers';
               }, function (error) {
                   //console.log(error);
               });

MVC Controller:

 [HttpPost]
        public ActionResult PostMembers(GroupedMembers grpMembers)
        {
            var result = grpMembers;
            return RedirectToAction("GroupedTeamMembers", result);

        }
        public ActionResult GroupedTeamMembers(GroupedMembers grouped)
        {

            return View(grouped);
        }

it is not working ...

please help me to pass data from one angularjs controller to another angularjs controller through MVC controller...

Thanks In Advance.......

chaitanya k
  • 199
  • 1
  • 3
  • 14

1 Answers1

0

You have to use sessions to pass data between controllers. check this one ex

Sudi065
  • 447
  • 6
  • 11
  • thanq for ur response... i had done as u said... i used session..i want to display list... so assigned list to the session and i wanna use that session in angularjs controller , but the session is showing the namespace of list instead of displaying list, so tried using convert the list to json format string and assigned to session and try to display in angularjs script controller, but it is showing " in place of quots...how can i rectify this...i used replace string method but it does not works – chaitanya k Apr 30 '18 at 05:25
  • Suppose if you're getting the result from Database, get that result as a List and convert that to Json, like below, var opGet = objClm.getInfo(nParams).ToList(); return Json(opGet, JsonRequestBehavior.AllowGet); – Sudi065 Apr 30 '18 at 16:04