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
Post a Comment