4

I am getting the syntax error:

Uncaught SyntaxError: missing ) after argument list

From this AngularJS code:

dataProvider.CustomAssets.save({
    'product'   : product.id,
    'store'     : store.id
})
.then(function(asset){
    $scope.product.assets.key.push(
        name            : asset[0],
        additionalPrice : asset[1],
        file            : asset[2],
        attribute       : asset[3]
    );
})
.catch(function(error){
    $log.error(error);
});

What kinds of mistakes produce this AngularJS Syntax error?

1 Answer 1

3

You forget to wrap object with {} .

 $scope.product.assets.key.push(
        name            : asset[0],
        additionalPrice : asset[1],
        file            : asset[2],
        attribute       : asset[3]
    );

Try this

 $scope.product.assets.key.push({
        name            : asset[0],
        additionalPrice : asset[1],
        file            : asset[2],
        attribute       : asset[3]
    });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.