Well, I'm making a switch using Angular Material switch, but it's not starting with its initial state as you can see on the picture. The label aside it is the value of it.
And as you can see, the switch starts deactivated from the beginning.
To Start, I'm getting the results from a get request, and putting it into an array.
$scope.questions = [];
The value I'm showing on the picture can be false or true.
On the md-switch
, I've referenced directly to the property inside of the array.
<tr ng-repeat="quest in questions">
<td><md-switch ng-model="quest.status">{{quest.status}}</md-switch></td>
</tr>
How can I set the value initially for the switch?
This is a Codepen with a test. http://codepen.io/anon/pen/BjzpNN
but this seems awkward tho. Doing my example it works fine, but with my development environment, it doesn't work.
This is the console.log of my array, I'm getting this as a get request using $resource
.
Well, what is the problem?
Edit2:
Even more awkward, using the properties ng-true-value and ng-false-value the switch doesn't get the initial state.