我想做这样的事情:
function doSometing(array, dynamicID){
$scope.property1_dynamicID = SomeFunction();
$scope.property2_dynamicID = OtherFunction();
}
这样做的正确方法是什么?
答案 0 :(得分:2)
var propertyName = 'property1_' + dynamicID;
$scope[propertyName] = someFunction();