I have a service "MyService" that contains the following:
this.myobj = {'dog': 'bark', 'cat': 'meow'}
I inject this service into a directive. Within the directive link function I have a $scope.$destroy that does the following:
console.log(MyService.myobj);
delete MyService.myobj.dog;
console.log(MyService.myobj);
The console.log output looks like after the delete still shows up as:
{'dog': 'bark', 'cat': 'meow'}
Even though I called the delete on the 'dog' key. What is going on? Is there a more proper way to delete the key?