Integrating AngularJS in a JSP application using Spring-MVC -


we have jsp application developed spring-mvc needs integrate angularjs in parts of user interaction.

we running problem urls. jsp application construct correct url uses <c:url/> prepends url root path of given application. can of course source anglularjs in jsp. but, angularjs uses internally many relative urls end being not found because lack root path of web application. can done it?

example of angularjs use of relative urls:

var app = angular.module("app", ['ngdragdrop', "ngroute", "editor", "popup", "history", "state", "launch"])         .config(function($routeprovider) {              $routeprovider.otherwise({                 templateurl: "res/views/actioner-view.html"             });          }); 

in jsp, before loading scripts, add following line:

var context_path = '${pagecontext.request.contextpath}'; 

and everywhere define url in javascript code, use

templateurl: context_path + 'res/views/actioner-view.html' 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -