0
var value = attr.inlineEdit;
var field = value.substring(11);

//Here I have first_name in field variable

user.hit({field : scope.model}, auth.getCurrentUser().user_id).success(function () {
     console.log("Saved");
});

In the field key, I want that should be have first_name when I have first_name in field variable but I'm getting only field as a key.

It's weird but I need to do something on it.

1
  • 1
    i think {[field]: scope.model} is what you actually want. Commented Aug 16, 2017 at 12:01

2 Answers 2

1

I think {[field]: scope.model} is what you actually want.

Sign up to request clarification or add additional context in comments.

1 Comment

This is awesome Thanks a ton!
0

Why don't you create nested object with first_name as a key:

{field : { first_name : scope.model }}

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.