javascript - Angular data object key rename -


i know i'm missing simple.

i have object in $scope value. want reneame 1 of property.

so assume have

$scope.data = { prop1: value1, prop2: value2} 

now want object be:

$scope.data = { newprop: value1, prop2: value2}

i tried

$scope.data.prop1 = newprop; delete $scope.data.prop1; 

but have not success

how correctly angular data object?

thanks

update

for more info:

i tried update object child controller, called $scope.$parent.data

i think meant

$scope.data.newprop = $scope.data.prop1; delete $scope.data.prop1; 

jsfiddle demo


Comments

Popular posts from this blog

json - Zend error Connection -

javascript - Trigger mouseenter when an animated element touches mouse -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -