I started working with AngularJS and I embraced the convention for writing controllers with this, not with $scope. So my controllers look like this:
myApp.controller("SomeController", function(){
this.myModel={id:-1, name:"empty"};
});
<div ng-controller="SomeController as ctrl">
<input type="text" ng-model="ctrl.myModel.name" />
</div>
Now, I changed the myModel object in the controller in a way like this:
this.myModel=someOtherObjectFromAForeignSource;
... and the value inside the input control doesn't change. I read about the $apply function and it's use but since i use the "this" convention, I don't have a $scope variable.
How do I call the $apply method?
$apply()? Where does that other data come from? - Yourinputis also set to thenameproperty - does your new object contain that property?this.myModel=someOtherObjectFromAForeignSource;. Because the model should be updated IF you are not using a third party library in your controller (like jQuery).