I am struggling with following error since last 2 hours. I dont know whats wrong.
SyntaxError: Unexpected end of input
at eval (<anonymous>)
at Function.globalEval (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js:4:4228)
at init.domManip (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js:5:20866)
at init.append (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js:5:18502)
at init.<anonymous> (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js:5:19874)
at Function.access (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js:4:5765)
at init.html (https://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.0/jquery.min.js:5:19537)
at Object.<anonymous> (http://127.0.0.1:8887/js/angular-ui-router.min.js:7:24156)
at https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js:16:71
at ta (https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.1/angular.min.js:84:35) <div ui-view="" class="ng-scope">
I could only find that this occurs when i call an angjs service
app.factory("Userservice", ['$rootScope', '$http', 'GENERAL_CONFIG', 'FlashService',
function($rootScope, $http, GENERAL_CONFIG, FlashService) {
return {
FindUserDetail: function(userid) {
return $http.get(String.format('{0}/GetUserDetailById?UserId={1}',
GENERAL_CONFIG.ServiceWebApiUrl,
userid));
}
};
}
]);
Following is my controller code
var userId = loggedIn.userId;
Userservice.FindUserDetail(userId).then(//this line throws error
function(data) {
if (data.data != null || data.data != undefined) {
var a = data.data.myJsonVariable //I get valid data here
}
},
function(httperror) {
FlashService.Error("Error Status Is " + httperror.status, true);
});
Unexpected end of input is very generic error. Guide me.
GetUserDetailById. It is probably returning an incomplete or invalid json string. Can you edit to add in the response coming from the server for this call?String.formatfrom ? Have you extended the prototype?