1

I'm confused a little about Arrays in Typescript ( Angular 2 ) I need a follow array to send to my API.

array = [
cadSocios => true,
name => ['name1', 'name2'],
part => ['part1', 'part2']
];

How Can I do this?

1
  • That's not array, that's an object. Commented Feb 9, 2017 at 14:11

2 Answers 2

1

Use Json.

array = {
"cadSocios" : true,
"name" : ['name1', 'name2'],
part : ['part1', 'part2']
};
Sign up to request clarification or add additional context in comments.

Comments

0

here is your object representation in json array

array=[
  {'cadSocios': true, 'name': 'name_1', 'part': 'part_1' },
  {'cadSocios': true, 'name': 'name_2', 'part': 'part_2' },
  //...
  {'cadSocios': true, 'name': 'name_n', 'part': 'part_n' },
]

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.