0

I have a kendo multi select widget in my template, the code for which is given below.

<div ng-repeat="program in user.programs">
    <label class="label-multi">{{program.name}}:</label>
    <select kendo-multi-select="" k-option-label="'Select Services...'" k-data-text-field="'name'" k-data-value-field="'id'" k-data-source="services" k-ng-model="selectedServices" >
    </select>
</div>

Each user has several programs, and each program has some services. Now I want to show the services that are already associated with the program i.e selectedServices which I initialize in my controller like so:

$scope.selectedServices = ["S1","S2"];

But the problem is that selectedServices vary for each program. I was thinking about doing something like selectedServices[0], selectedServices[1] and so on using $index. How do I achieve this and how do assign values to these selectedServices in my controller? Wouldn't it be an array of arrays?

1 Answer 1

1

Why don't you add a selectedServices array to user.programs?
For example:

$scope.user.programs.selectedServices = ["S1", "S2"];
Sign up to request clarification or add additional context in comments.

2 Comments

You are a genius and I'm an idiot. You made my life about 10x time easier, thanks man!
Glad to be helpful... ;-)

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.