Hello I have this component:
zpc.component("myComponent", {
template: '<button ng-click="$ctrl.find()">CLICK</button>\
{{$ctrl.results|json}}\ //allways empty
</div>',
controller: function MyComponent($http) {
this.text = "";
this.results = [];
this.find = function () {
$http.get("https://swapi.co/api/films/1").then(function (response) {
this.results = response.data;
console.log(this.results); //here is data
});
}
}
});
After click data is loaded correctly, but will not appear in the view. How to bind data to view from async? Thank you.