我的路由如下,并且在应用程序中工作正常。
config(["$routeProvider", function ($routeProvider,$locationProvider) {
$routeProvider
.when('/some', {
templateUrl: '/temp/index.html',
controller: 'someController'
})
.otherwise({
redirectTo: "/"
});
$locationProvider.html5Mode(true);
}
]);
现在,我想实施一个休息服务,如下所示,以便直接从浏览器访问它,例如 www.app.com/rest 。
.when('/rest', {
controller: 'restController'
})
在这种情况下,我得到404。在我的方案中,无法在web.xml中对其进行配置。如何实现直接从浏览器通过/ rest路由。
答案 0 :(得分:0)
您需要添加一个template或templateUrl来路由/ rest端点的对象。 从$ routeProvider AngularJS文档中: when(路径,路线)
需要templateUrl或模板之一。