How can I refresh query result of $resource in AngularJS without refreshing the page?
My page:
<div class="container" ng-controller="AppController">
<div ng-repeat="tile in items">
<p>{{tile.name}}</p>
</div>
<button ng-click='??'> Reload tiles </button>
</div>
Controller:
(function(angular) {
var AppController = function($scope, Item) {
Item.query(function(response) {
$scope.items = response ? response : [];
});
};
AppController.$inject = ['$scope', 'Item'];
angular.module("myApp.controllers").controller("AppController", AppController);
}(angular));
I know it's possibly very noob question however I could not find any solution yet (today is my first day with AngularJS, so any help is appreciated).