Angularjs - Calling json web service always returns 404

I am new to angularjs. I am using it with ionic framework. I am trying to calling a json web service but it always returns 404.

When I try in browser it works perfectly fine.

here is my code:

function FetchCtrl($scope, $http) {

    $scope.fetch = function() {

        $http({method: 'GET', url: 'http://example.com/anyservice'}).
          success(function(data, status, headers, config) {

            alert("data "+data);
          }).
          error(function(data, status, headers, config) {

            alert("error "+status);

          });

      };
 }

Use either Chrome or FireFox Developer Tools and open the Network tab, then give it a shot and see what the actual request is that is happening, that should help you finding your problem.