Why can't I overwrite the value of a variable like this?
I'm trying to figure out why I'm having trouble overwriting a value passed to an angularJS directive via an isolate scope ( @ ). I try to overwrite the value of vm.index with the following: vm.index = parseInt(vm.index, 10) However, it doesn't work for some reason. If I change it to: vm.newIndex = parseInt(vm.index, 10) It works. Also, assigning the value on the $scope works. Why doesn't the first method work? I've created this example plunker for reference. As you used @ here which need value from an attribute with {{}} interpolation directive. And seems like directive is getting loaded first