ngResource Url 参数问题

ngResource Url parameter issue

我正在使用 HTML、JS、AngularJS 针对 SharePoint Server 2013 搜索 API 的 REST 端点创建提前输入人员搜索。

我的具体问题在我的资源定义中。

我使用的 SharePoint 搜索查询模式包含冒号 (:):

.../_api/search/query?querytext=%27John+AND+Memberships:GRP-InformationSystems%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27

这里是服务的实现:

var searchService = servicesMod.factory('searchPeople', ['$resource',
    function ($resource) {
        return $resource('http://teamsint/_api/search/query?querytext=%27:searchText+AND+Memberships:GRP-InformationSystems%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27', { 'searchText': '@@searchText' }, {
            query: { method: 'GET', isArray: false, withCredentials: true },
        });
    }]);

... 和 angularjs 将其错误识别为参数并将其从资源 URL.

中删除

并且请求像这样到达服务器:

http://mysharepointserver/_api/search/query?querytext=%27John+AND+Memberships:-InformationSystems%27&sourceid=%27B09A7990-05EA-4AF9-81EF-EDFAB16C4E31%27

":GRP" 是搜索查询的一部分,正在从 URL.

中解析出来

有没有办法 escape 冒号在这种情况下被忽略?

谢谢!

此处的修复是当您不希望 angularjs (1.5) 认为它是参数时,将查询字符串中的冒号 (:) 替换为 %3A