AngularJS Syntax of $ in Different Versions

The http post action in AngularJS versions is designed with different syntaxes:

We normally use or see lots of online source code as $http…post…success(function ())…error(function()), but it is the syntax in AngularJS v1.3.20, The most recent AngularJS version might be v1.5.8x, and we could find many syntax changing in new versions.

For the AngularJS $ syntax:

The newest AngularJS use the following syntax:

  method: ‘POST’,
  url: ‘/someUrl’,
}).then(function successCallback(response) {
    // this callback will be called asynchronously
    // when the response is available
  }, function errorCallback(response) {
    // called asynchronously if an error occurs
    // or server returns response with an error status.

The following is the shortcut syntax and different syntax in different versions:

AngularJS v1.3.x

 $, data, config)
            .success(function (data, status, headers, config) {
            .error(function (data, status, header, config) {

AngularJS v 1.4x, v 1.5x:

$, data, config)
         // success callback
         // failure callback

Check more details information from AngularJS official document website.