pardon me if this is a repeat question and i am still a beginner.
see the code below :
$scope.clicked=function(key,value){
$scope[key]=value;}
the above code returns $scope.key
is undefined or $scope.key=value
even if i pass any value to key. lets say i call the function using $scope.clicked('yes','i am yes')
. I want $scope.yes = 'i am yes';
what i get is $scope.keys='i am yes';
. how do i achieve what i want.?
$scope[key]=value
; should work. – BatScream 18 hours ago$scope.[key]=value
is invalid syntax. Try$scope[key]=value
– Ed Cottrell 18 hours ago