javascript - angular, setting a variable as scope name -
i'm trying pass in variable function alter scope info receiving set into. having problem getting work - i'm not sure if right way of doing this. here's i'm doing -
$scope.upload = function(element, type){ //call function .success(function(){ //in success set info in our new scope $scope.type = data; })
so i'm trying accomplish phone call function set scope name sending type. problem ( think) having, angular inst recognizing variable when set $scope. in front end of it, when seek drop variable new scope in $scope.type, believe thinks mean "$scope.type" not $scope.(my variable passed in). possible? maybe have escape in here?
thanks reading!
use bracket notation ($scope
object afterall):
$scope[type] = data;
javascript angularjs
No comments:
Post a Comment