when running the app that I have build on angular/phonegap I get the following error
Uncaught SyntaxError: Unexpected token =
The error is caused by the default value supplied for the parameter.But why is that?It works perfectly fine on a few devices and throws this error on others. Here is the code:
.factory('foo' , function(){
return {
test : function(id = 0){
console.log(id);
}
}
})
Here is the solution :
.factory('foo' , function(){
return {
test : function(id){
id = ( id !== undefined ) ? id : 0;
console.log(id);
}
}
})