I have 3 Asp.Net MVC controllers and all have one Index view. I am trying to do angularjs routing for the actions. Assuming the urls are like
http://localhost/Budget/Index (default controller)
http://localhost/Vacations/Index
http://localhost/CompanyTests/Index
In all three of my Index.cshtml files I've [ng-view] and have setup corresponding html files with angular controllers. In my app.js main module, I have a default route that opens budgetindex.html when the url is /#/. I have configured all angular routes.
Assuming I'm on this URL:
http://localhost/CompanyTests/Index/#/tests
My angular route opens up companytestindex.html, I have a form that submits a POST request on one of the action on CompanyTests MVC controller and I'm returning RedirectToAction Index after processing the file upload which takes me to the url below
http://localhost/CompanyTests/Index
And after angular route takes control it rightly considers it as /#/ and executes the default route which is not what i want. I want the user to be direct to same screen where he uploaded the file.
The summary of the question is, for multiple asp.net mvc controllers i have angular routes and my html templates post data to asp.net mvc actions. After executing the action it returns back to Controller/Index and angular considers it as the default endpoint and opens up the incorrect html.
I have already spent days trying to look for articles explaining angularjs routing with multiple asp.net mvc controllers but haven't found any help. I just need a little direction here.
Thanks
RedirectToAction
I guess you won't be able to set custom parameters , I guess you requireRedirect
method that contains your/#/someroute
in url and then angular will identify proper view when its on client side. – vishal sharma 19 hours ago