Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit cd2af6e

Browse files
author
Kent C. Dodds
committed
Changing the demo to use hideExpression because it's much easier
1 parent 7ce7baa commit cd2af6e

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/views/home.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ app.controller('home', function($scope, $parse, $rootScope) {
137137
key: 'hiddenWhenUnchecked',
138138
type: 'text',
139139
label: 'Conditional input',
140-
hide: true
140+
hideExpression: '!checkThis'
141141
}, {
142142
key:'secretCode',
143143
type: 'hidden',
@@ -154,12 +154,4 @@ app.controller('home', function($scope, $parse, $rootScope) {
154154
$scope.formOptionsStr = $scope.toPrettyJSON($scope.formOptions, 4);
155155
$scope.formFieldsError = false;
156156
$scope.formOptionsError = false;
157-
var hiddenWhenUncheckedIndex = 0;
158-
$scope.formFields.some(function(field, index) {
159-
hiddenWhenUncheckedIndex = index;
160-
return field.key === 'hiddenWhenUnchecked';
161-
});
162-
$scope.$watch('formData.checkThis', function(isChecked) {
163-
$scope.formFields[hiddenWhenUncheckedIndex].hide = !isChecked;
164-
});
165157
});

0 commit comments

Comments
 (0)