【发布时间】:2015-07-18 08:23:27
【问题描述】:
我们有一个使用 Spring-MVC 开发的 JSP 应用程序,它需要在用户交互的某些部分与 AngularJS 集成。
我们遇到了网址问题。构建正确 url 的 JSP 应用程序使用 <c:url/>,它在 url 前面加上给定应用程序的根路径。我们当然可以在 JSP 中获取 AngularJS。但是,AngularJS 在内部使用了许多相对 url,最终找不到,因为它们缺少 Web 应用程序的根路径。有什么办法呢?
AngularJS 使用相对 url 的示例:
var app = angular.module("app", ['ngDragDrop', "ngRoute", "editor", "popup", "history", "state", "launch"])
.config(function($routeProvider) {
$routeProvider.otherwise({
templateUrl: "res/views/actioner-view.html"
});
});
【问题讨论】:
标签: angularjs jsp spring-mvc