Well yes.
In JavaScript, you can access object variables using the [] notation. Take the following example
var str = 'hello'; var obj = { hello: 'a' }; console.info(obj[str]);
so if formName is a string, you can just get the scope property with
var form = $scope[formName]
source share