Angular js api url调用不起作用

时间:2014-08-03 06:45:16

标签: angularjs angularjs-scope angularjs-routing

app.controller('Ctrl', function ($scope, $http) {

        $http({method: 'GET', url: "/api/v1/coupons-dunia/coupons-by-website?websiteId=1"}).success(function(data) {
           $scope.onlinedata = data.coupons;
           $scope.website = data.websites;
        });

当我通过www.mydomain.com/cccc/xxxx/工作正常时,但当我尝试传递/api/v1/coupons-dunia/coupons-by-website?websiteId=1显示错误时,"SyntaxError: illegal character"

我正在使用AngularJS v1.2.21。

1 个答案:

答案 0 :(得分:2)

尝试:

$http({method: 'GET', url: "/api/v1/coupons-dunia/coupons-by-website", params: {websiteId:1})