change <li ng-click="toggleCheckbox('LandDTO.Car.Motor')">
to <li ng-click="toggleCheckbox('Motor')">
and in function change it to
$scope.toggleCheckbox = function (model) {
$scope.LandDTO.Car[model] = true;
};
Question
I have this HTML
<li ng-click="toggleCheckbox('LandDTO.Car.Motor')">
<li ng-click="toggleCheckbox('LandDTO.Car.Motor2')">
and here is my function
$scope.toggleCheckbox = function (model) {
$scope[model] = true;
};
Its not working, what am I doing wrong?
Solution
change <li ng-click="toggleCheckbox('LandDTO.Car.Motor')">
to <li ng-click="toggleCheckbox('Motor')">
and in function change it to
$scope.toggleCheckbox = function (model) {
$scope.LandDTO.Car[model] = true;
};