My value, stored in data, gets displayed on the viewer when I assign to $scope and refer to it in the viewer as {{data}} but not when I assign it to a field inside my controller and refer to it as {{controller.thing.data}}. In the latter scenario, I see no errors in the console and I see thing.data getting populated when I set a breakpoint.
Where am I going wrong ?
Viewer
<html ng-app="controller" ng-controller="MyController as controller">
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.16/angular.min.js"></script>
<script type="text/javascript" src="controller.js"></script>
<script type="text/javascript" src="services.js"></script>
</head>
<body>
{{controller.thing.data}}
</body>
</html>
Controller
angular.module('controller', ['services'])
.controller('MyController', ['MyService', '$scope', function(MyService, $scope) {
var thing = this;
MyService.getData().then(function(data) {
thing.data=data;
});
}]);