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

Commit

Permalink
fix hideExpression model
Browse files Browse the repository at this point in the history
  • Loading branch information
kwypchlo committed Jan 16, 2016
1 parent 61dfd04 commit 8c0bb8b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/directives/formly-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,13 @@ function formlyForm(formlyUsability, formlyWarn, $parse, formlyConfig, $interpol
}

function runFieldExpressionProperties(field, index) {
const model = field.model || $scope.model
const promise = field.runExpressions && field.runExpressions()
if (field.hideExpression) { // can't use hide with expressionProperties reliably
const model = field.model || $scope.model
// add model to extra locals to be sure the expression is evaluated in correct context
const extraLocals = angular.extend(getFormlyFieldLikeLocals(field, index), {model})
const val = model[field.key]
field.hide = evalCloseToFormlyExpression(field.hideExpression, val, field, index)
field.hide = formlyUtil.formlyEval($scope, field.hideExpression, val, val, extraLocals)
}
if (field.extras && field.extras.validateOnModelChange && field.formControl) {
const validate = field.formControl.$validate
Expand Down

0 comments on commit 8c0bb8b

Please sign in to comment.