Spartan Spartan - 2 months ago 20
AngularJS Question

Angular Js + jslint error for callback

$http({
method: 'POST',
datatype:'json',
url: '/CreateUser',
data:data
cache: false
}).success(function (data){ //Error:jslint gives me error here for bad looping
console.log(data.message);
}
}).error(function (error){
console.log(error.message);
});


I use jslint package in Atom Editor, where I pass callback response it gives me error Error:jslint gives me error here for bad looping what is this?
Can someone explain me?

Answer

you have two } in the success callback.

$http({
    method: 'POST',
    datatype:'json',
    url: '/CreateUser',
    data:data
    cache: false
}).success(function (data){
    console.log(data.message);
}).error(function (error){
    console.log(error.message);
});