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

Commit af2303f

Browse files
author
Kent C. Dodds
committed
Changing the demo to use hideExpression because it's much easier
1 parent 496772b commit af2303f

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
@@ -147,7 +147,7 @@ app.controller('home', function($scope, $parse, $rootScope) {
147147
key: 'hiddenWhenUnchecked',
148148
type: 'text',
149149
label: 'Conditional input',
150-
hide: true
150+
hideExpression: '!checkThis'
151151
}, {
152152
key:'secretCode',
153153
type: 'hidden',
@@ -164,12 +164,4 @@ app.controller('home', function($scope, $parse, $rootScope) {
164164
$scope.formOptionsStr = $scope.toPrettyJSON($scope.formOptions, 4);
165165
$scope.formFieldsError = false;
166166
$scope.formOptionsError = false;
167-
var hiddenWhenUncheckedIndex = 0;
168-
$scope.formFields.some(function(field, index) {
169-
hiddenWhenUncheckedIndex = index;
170-
return field.key === 'hiddenWhenUnchecked';
171-
});
172-
$scope.$watch('formData.checkThis', function(isChecked) {
173-
$scope.formFields[hiddenWhenUncheckedIndex].hide = !isChecked;
174-
});
175167
});

0 commit comments

Comments
 (0)