0

I have an array called data.list that stores a list of mandatory and optional appointments:

data.list.push({
  mandatory: appt.getDisplayValue('mandatory_appointments'),
  optional: appt.getDisplayValue('optional_appointments')
});

Mandatory and Optional returns a comma separate list of appointments that looks like this:

appointment1, appointment2, appointment3, appointment4, etc...

For my HTML, I wanted to use ng-repeat to produce a list of mandatory and optional tasks that looks like this:

appointment1

appointment2

appointment3

appointment4

What do I need to change in order to achieve this?

<div ng-repeat="item in c.list track by $index">
   {{item.mandatory}}
</div>

2 Answers 2

1

If you mean the values of the mandatory and optional are strings and separated by comma(,). You need to use string.split(",") to generate an array.

See this fiddle for demo. Hope it helps! https://fiddle.jshell.net/pe25b0aa/8/

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

1 Comment

thanks!! ahh did not think to even do ng-repeats within ng-repeats, thanks for the help!
0

You can add br after item.mandatory , like this

<div ng-repeat="item in c.list track by $index">
{{item.mandatory}} <br>
</div>

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.