【发布时间】:2016-10-13 12:49:39
【问题描述】:
我在 angularJS 上进行路由以符合代码点火器配置中设置的基本 url 的挑战
例如,如果我当前的网址是
http://localhost:8080/example/details
并且有来自该页面的 Angular 控制器的 Angular 服务调用,如下所示
$http.get("api/gallery/" + 4).success(function (data) {
galleryResource.getAll().$promise.then(function (response) {
console.log(response);
}, function (response) {
console.log(response);
});
调用的 url 将是
http://localhost:8080/example/api/gallery/4
但是当url是现在
http://localhost:8080/example/details/4
同样的服务被调用,将被调用的url将是
http://localhost:8080/example/details/api/gallery/4
我现在的问题是,有没有办法确保 api url 不跟随地址栏中的当前 url 从基本 url 开始,因为在上面的示例中我希望 api url 是
http://localhost:8080/example/api/gallery/4
当我在带有 url 的页面上时
http://localhost:8080/example/details/4 感谢期待您的回复``
【问题讨论】:
标签: php angularjs codeigniter