Himanshu Bhuyan
Himanshu Bhuyan

Reputation: 306

Angular js api url call not working

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;
        });

When I pass www.mydomain.com/cccc/xxxx/ its working fine,But when i try to pass /api/v1/coupons-dunia/coupons-by-website?websiteId=1 its show error, "SyntaxError: illegal character"

I am using AngularJS v1.2.21 .

Upvotes: 1

Views: 495

Answers (1)

Michael Kang
Michael Kang

Reputation: 52847

Try:

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

Upvotes: 2

Related Questions