I am using Angular, I need to refresh the view after DELETE a row. Current code work properly but the Table is not update at all.
Any idea how to change my code?
'use strict'; app.controller('locationsController', ['$scope', 'locationsService', function ($scope, locationsService) {
$scope.locations = [];
locationsService.getLocations().then(function (results) {
    $scope.locations = results.data;
}, function (error) {
    //alert(error.data.message);
});
$scope.deleteLocation = function (locationId) {
    locationsService.deleteLocation(locationId); // UPDATE THE VIEW
};
}]);
<div>
    <div>
        <table>
            <thead>
                <tr>
                    <th>Action</th>
                    <th>LocationId</th>
                    <th>Name</th>
                </tr>
            </thead>
            <tbody>
                <tr data-ng-repeat="location in locations">
                    <td>
                        <a href="#/login">Edit</a>
                        <button ng-click="deleteLocation(location.locationId);">Delete</button>
                    </td>
                    <td>
                        {{ location.locationId }}
                    </td>
                    <td>
                        {{ location.name }}
                    </td>
                </tr>
            </tbody>
        </table>
        <table>
            <thead>
                <tr>
                    <th>LocationId</th>
                    <th>Name</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>
                        {{ location.locationId }}
                    </td>
                    <td>
                        <input type="text" name="{{ location.name }}">
                    </td>
                </tr>
        </table>
    </div>
</div>
'use strict';
app.factory('locationsService', ['$http', function ($http) {
    var serviceBase = 'http://localhost:4014/';
    var locationsServiceFactory = {};
    var _getLocations = function () {
        return $http.get(serviceBase + 'api/locations').then(function (results) {
            return results;
        });
    };
    var _deleteLocation = function (locationId) {
        return $http.delete(serviceBase + 'api/locations/' + locationId).then(function (results) {
            return results;
        });
    };
    locationsServiceFactory.getLocations = _getLocations;
    locationsServiceFactory.deleteLocation = _deleteLocation;
    return locationsServiceFactory;
}]);