AngularJS $资源URL导致"问号" ?出现无PARAMS [英] AngularJS $resource url causes "question mark" ? to appear with no params

查看:157
本文介绍了AngularJS $资源URL导致"问号" ?出现无PARAMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个$资源定义自定义网址为:所有的方法。

I have a $resource that defines a custom url for the :all method.

angular.module('MyApp').
  factory('Object', ['$resource', ($resource) ->
    $resource(
      '/api/groups/:group_id/objects/:id.json',
      {
        id: '@id',
        group_id: '@group_id'
      },
      all: {
        method: 'GET',
        url: '/api/objects/all.json'
      }
    )
  ])

在我的页面加载,请求外出/api/objects/all.json?。它正确加载,但其中的presence?是混淆了我。我没有通过任何参数,所以为什么角加?的请求?

When my page loads, the request goes out to '/api/objects/all.json?'. It's loading correctly, but the presence of the ? is confusing to me. I didn't pass it any parameters, so why does angular add the ? to the request?

我可以摆脱它不知何故?

Can I get rid of it somehow?

推荐答案

由于角v.1.2.14此问题已得到修复。更新到它,并有一个明确的网址没有不必要的问题。

Since angular v.1.2.14 this issue has been fixed. Update to it and have a clear url without unnecessary question

这篇关于AngularJS $资源URL导致"问号" ?出现无PARAMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆