I have a requirement – single angular js function to return the scope variable dynamically based on one of the input parameter to the function. For controller function, I found some example on how to return dynamic scope like
$scope[attributeId] = data.response; (attributeId is an input parameter, data.response is an array)
Question is how to use such scope variable in HTML? I have a select control like this which will populate a dropdown with the values retuned in the scope, what should be specified as model and option in such case.
<button ng-click="getAttributeValue(getProductsModel,p.attributeId, $event)">Get Attribute Value</button>
<select data-ng-model="attributeModel"
data-ng-options="a for a in attributeResponse">
<option value="">-- Select Value --</option>
</select>
An example would really help.