https://plnkr.co/edit/hccJqwtDlqcOBhxnwZ94?p=preview
In this example when the factory return value changes in $timeout, the scope variable which points to the factory (in this case anotherVar) reflects the change but the variable that points the specific property (var) does not.
// Code goes here
angular.module("sample",[])
.controller("myctrl",function($scope,TestService){
$scope.var = TestService.name;
$scope.anotherVar = TestService;
})
.factory('TestService',function($timeout){
var ret = {};
ret.name = "temporary";
$timeout(function() {
ret.name = "final";
},4000);
return ret;
});
<!DOCTYPE html>
<html>
<head>
<script data-require="[email protected]" data-semver="1.6.6" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.6/angular.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body ng-app="sample" ng-controller="myctrl">
<h1>Hello Plunker!</h1>
Value: {{var}} <br>
Another Value : {{anotherVar}}
</body>
</html>