java - Passing $routeParams from angularjs to spring-MVC controller -
this have in angularjs controller
.when("/m:topicid", {templateurl: "mu", controller: "conmfs"}) app.controller('conmfs',function($scope,$routeparams){ $scope.otherid = $routeparams.topicid; });
this spring controller
@requestmapping(value="/controlerm", method = requestmethod.get) public modelandview controlerm(httpservletrequest request, httpservletresponse response) throws exception { modelandview model = null; session=request.getsession(true); user = (user) session.getattribute("user"); list<ends1> ends=(list<ends1>) ifriendlistservice.getends(user.getid(),5); session.setattribute("mutualfriends", mutualfriends); model = new modelandview("ends"); return model;
i able fetch topicid
angularjs page in angularjs controller (with $scope.otherid
), unable pass value spring controller, redirecting new page.
how should this?
.when("/m:topicid", {templateurl: "mu", controller: "conmfs"}) app.controller('conmfs',function($window){ $window.location.reload(); });
then server app gets topicid
request's url. need have $locationprovider.html5mode
enabled.
how should this?
you shouldn't. angular's off-hour job not let server apps reload page. code above quick-and-dirty, can ok if you're in middle of angular integration existing project, time-frame requires partially rely on old code base.
if need make redirect (e.g. external page), make ajax request, put topicid
, whatever there, redirect url in response, redirect $window.location.href
.
i'm barely familiar spring, above applies server-side application.
Comments
Post a Comment