AngularJS 1.7 – HTTP POST

Upgrade to angularjs version 1.7 and this code does not compile

app.factory('LoginService', function ($http) {
        return {
            login: function (param, callback) {
                $http.post(url, param)
                   .success(callback)
                   .error(function (data, status, headers, config) {
                   });
            }
        };
    });

On the controller I make the call to the service LoginService

    function LoginController($http, $location, LoginService, blockUI) {
    var vm = this;
    LoginService.usuario(
          {login: vm.username, clave: vm.password},
      function (data, status, headers, config) {                
              vm.resultado = data;
              if (vm.resultado == "True") {
                  window.location = "/Home/Index";
              } else {
                  vm.error = 'Usuario o password incorrecto';
              }
          });
};

I want to know how the function is called from the controller because it implemented the http.post service using .then

app.factory('LoginService', function ($http) {
        return {
            login: function (data) {
                $http.post(url, data)
                    .then(function (resultado) {
                        debugger;
                        if (resultado.data === "True") {
                            return resultado.data;}
                        else {
                              console.log("NO");}
                         });
                       }};
                      });

Source: AngularJS