@@ -168,8 +168,8 @@ angular.module('schemaForm').provider('schemaFormDecorators',
168168
169169 var createDirective = function ( name ) {
170170 $compileProvider . directive ( name ,
171- [ '$parse' , '$compile' , '$http' , '$templateCache' , '$interpolate' , '$q' , 'sfErrorMessage' ,
172- function ( $parse , $compile , $http , $templateCache , $interpolate , $q , sfErrorMessage ) {
171+ [ '$parse' , '$compile' , '$http' , '$templateCache' , '$interpolate' , '$q' , 'sfErrorMessage' , 'sfPath' ,
172+ function ( $parse , $compile , $http , $templateCache , $interpolate , $q , sfErrorMessage , sfPath ) {
173173
174174 return {
175175 restrict : 'AE' ,
@@ -341,18 +341,23 @@ angular.module('schemaForm').provider('schemaFormDecorators',
341341 // Do we have a condition? Then we slap on an ng-if on all children,
342342 // but be nice to existing ng-if.
343343 if ( form . condition ) {
344+
345+ var evalExpr = 'evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex})' ;
346+ if ( form . key ) {
347+ evalExpr = 'evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex, "modelValue": model' + sfPath . stringify ( form . key ) + '})' ;
348+ }
349+
344350 angular . forEach ( element . children ( ) , function ( child ) {
345351 var ngIf = child . getAttribute ( 'ng-if' ) ;
346352 child . setAttribute (
347353 'ng-if' ,
348354 ngIf ?
349355 '(' + ngIf +
350- ') || (evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex }) )'
351- : ' evalExpr(form.condition,{ model: model, "arrayIndex": arrayIndex })'
356+ ') || (' + evalExpr + ' )'
357+ : evalExpr
352358 ) ;
353359 } ) ;
354360 }
355-
356361 $compile ( element . contents ( ) ) ( scope ) ;
357362 } ) ;
358363
0 commit comments