Skip to content

Commit 47cda69

Browse files
committed
feat(forms) Add getVal function to record-handler
1 parent 88f5694 commit 47cda69

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

js/services/record-handler.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,15 @@ formsAngular.factory('recordHandler', function (
725725
return text;
726726
};
727727

728+
$scope.getVal = function(expression, index) {
729+
if (expression.indexOf('$index') === -1 || typeof index !== 'undefined') {
730+
expression = expression.replace(/\$index/g, index);
731+
return $scope.$eval('record.' + expression);
732+
} else {
733+
throw new Error('Invalid expression in getVal(): ', expression);
734+
}
735+
};
736+
728737

729738
};
730739

0 commit comments

Comments
 (0)