AngularJs depoyed site SyntaxError: Unexpected identifier

37 Views Asked by At

I've developed a ASP.NET WEB API Angularjs application and after i published it in IIS server it was throwing Unexpected identifier error at URL of below code.

function getAllWeeks() {
        var defer = $q.defer();
                   $http({
            method: 'GET',
            url: 'http://localhost/PS/api/ItemCements/AllWeeks', --> error here and message: SyntaxError:  Unexpected identifier
            params: {}
        }).then(function successCallback(response) {
            $scope.Weeks = response.data;
     }, function errorCallback(response) {              
        });
        return defer.promise;

The same code is working fine in my localhost and after deployment facing this issue.

Can somebody tell me what is the issue?

1

There are 1 best solutions below

0
TrevorBrooks On

Add localhost to the hosts file on the machine you have deployed it to - or replace localhost with a fully qualified domain name.

https://en.wikiversity.org/wiki/Hosts_file/Edit