@@ -427,12 +427,12 @@ They do need a list of ```items``` to have as children.
427427
428428### conditional
429429
430- A * conditional* is exactly the same as a * section* , i.e. a ``` <div> `` ` with other form elements in
431- it, hence they need an ``` items ``` property. They also need a ``` condition `` ` which is
430+ A * conditional* is exactly the same as a * section* , i.e. a ` <div> ` with other form elements in
431+ it, hence they need an ` items ` property. They also need a ` condition ` which is
432432a string with an angular expression. If that expression evaluates as thruthy the * conditional*
433433will be rendered into the DOM otherwise not. The expression is evaluated in the parent scope of
434- the ``` sf-schema `` ` directive (the same as onClick on buttons) but with access to the current model
435- under the name ``` model `` ` . This is useful for hiding/showing
434+ the ` sf-schema ` directive (the same as onClick on buttons) but with access to the current model
435+ and current array index under the name ` model ` and ` arrayIndex ` . This is useful for hiding/showing
436436parts of a form depending on another form control.
437437
438438ex. A checkbox that shows an input field for a code when checked
@@ -476,6 +476,58 @@ Note that angulars two-way binding automatically will update the conditional blo
476476event handlers and such. The condition need not reference a model value it could be anything in
477477scope.
478478
479+ The same example, but inside an array:
480+
481+ ``` javascript
482+ function FormCtrl ($scope ) {
483+ $scope .persons = []
484+
485+ $scope .schema = {
486+ " type" : " object" ,
487+ " properties" : {
488+ " persons" : {
489+ " type" : " array" ,
490+ " items" : {
491+ " type" : " object" ,
492+ " properties" : {
493+ " name" : {
494+ " type" : " string" ,
495+ " title" : " Name"
496+ },
497+ " eligible" : {
498+ " type" : " boolean" ,
499+ " title" : " Eligible for awesome things"
500+ },
501+ " code" : {
502+ " type" : " string"
503+ " title" : " The Code"
504+ }
505+ }
506+ }
507+ }
508+ }
509+ }
510+
511+ $scope .form = [
512+ {
513+ " key" : " persons" ,
514+ " items" : [
515+ " persons[].name" ,
516+ " persons[].eligible" ,
517+ {
518+ type: " conditional" ,
519+ condition: " persons[arrayIndex].eligible" , // or "model.eligable"
520+ items: [
521+ " persons[].code"
522+ ]
523+ }
524+ ]
525+ }
526+ ]
527+ }
528+ ```
529+
530+ Note that arrays inside arrays won't work with conditional.
479531
480532### select and checkboxes
481533
0 commit comments