JSFiddle - React, Tailwind, and code Playground
by Rob Sedgwick
HTML
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.11/angular.js"></script>
<div ng-app="app" ng-controller="ctrl">
<input type='checkbox' ng-model='createSelectionGetterSetter("Gareth")' ng-model-options='{ getterSetter: true }' />
<input type='text' ng-model='row.value' />
</div>
<hr/>
<pre>{{ selection | json }}</pre>
JavaScript
var app = angular.module('app',[]);
app.controller('ctrl', function($scope) {
$scope.data = [
{'name': 'a', 'value': '1'},
{'name': 'b', 'value': '2'},
{'name': 'c', 'value': '3'}
];
$scope.selection = {'a': false, 'b': false, 'c': false};
$scope.createSelectionGetterSetter = function(name) {
return function(newValue) {
if (angular.isDefined(newValue)) {
alert("tim");
$scope.selection[name] = newValue;
}
return $scope.selection[name];
};
};
$scope.ShowDisabled = true;
$scope.ShowHidden = false;
});