angular formly hide expression

1.1k Views Asked by At
{
"wrapper": "section",
"className": "row",
"hideExpression":"function($viewValue, $modelValue, scope){ return (scope.model['Application__c']['Years1__c'] && (parseFloat(scope.model['Application__c']['Years1__c']+'x.'+scope.model['Application__c']['Months1__c'])+parseFloat(scope.model['Application__c']['Years__c']+'.'+scope.model['Application__c']['Months__c']))>2); }" ,
"fieldGroup": [ {
  "key": "Application__c.City_Prev1__c",
  "type": "alphabet",
  "hideExpression":"function($viewValue, $modelValue, scope){ return !scope.model['Application__c']['Years1__c']  }" ,
  "className": "col-xs-7 col-sm-6 col-md-5 col-lg-5",
  "templateOptions": {
    "label": "City",
    "required": true,
    "maxlength": 20,
    "objectName": "Application__c",
    "fieldName": "City_Prev1__c"
  }
}]
}

In the above formly json, how can make hide expression as a function or how can I call a function from outside

1

There are 1 best solutions below

0
On

Please refer the link below

**Function constructor ** The Function constructor creates a new Function object. Calling the constructor directly can create functions dynamically, but suffers from security and performance issues similar to eval.