I've switched some Angular Js controller code from using the $scope object t "Controller as syntax with this".
However I can't quite get promises to update "this" correctly in my controllers.
For example in this case I'm making an $http call, and though it is getting called successfully, myProperty does not get updated.
<div ng-controller="MyController as controller">
{{controller.myProperty}}
</div>
<script type="text/javascript">
function MyController($http) {
this.myProperty = "First";
this.myMethod = function(){
this.myProperty = "Second";
$http.get("someUrl.html").success(function(){
this.myProperty = "Third";
});
};
this.myMethod();
};
</script>
Expected result -- "Third" , actual result - " Second"