1

I have the following code:

<input type="checkbox" data-col="1" name="eighth-slot" data-ng-model="scope.friends.calendar[0][8]" class="ng-pristine ng-valid">

the first [0] is the day of the week and the second [8] indicates a 2hr time slot and returns true/false indicating if they are free on that day during that particular time slot.

I figure binding the model to the input is the first thing but how do I make it checked if the the last parameter is true?

1 Answer 1

3

You do not need to say scope.friends.calendar[0][8] as scope is assumed to be receiver in the template. so just friends.calendar[0][8] is fine.

function Ctrl($scope) {
  $scope.friends = {calendar: [[]]};
  $scope.friends.calendar[0][8] = true;
}

for instance, would make the checkbox checked.

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.