The script:
app = angular.module('app', [])
app.factory 'MyFactory', ->
val: 'Clark Kent'
app.controller 'MainCtrl', ($scope, MyFactory) ->
MyFactory.val = 'Waldo'
$scope.myFactory = MyFactory
Put this in the console:
angular.injector(['ng','app']).invoke(function(MyFactory) { console.log(MyFactory); })
... and instead of Waldo
, you get Clark Kent
!!
Why doesn't it return the same object?
Check out the plunkr