javascript - Receiving Uncaught SyntaxError: missing ) after argument list -


i'm trying pass task object controller , if go this:

var task = task.save(task: {user_id: $scope.user.id}, $scope.newtext); 

i'm getting error saying uncaught syntaxerror: missing ) after argument list. what's wrong code? in advance.

you can't give arguments names in way. may have wanted pass in object via object initializer, in case need { , }:

var task = task.save({task: {user_id: $scope.user.id}, somenamehere: $scope.newtext}); // ------------------^-------------------------------------------------------------^ 

note somenamehere, you'll need name second property.

or if task.save accepts 2 separate arguments, remove task: part:

var task = task.save({user_id: $scope.user.id}, $scope.newtext); 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -