AngularJS Version Object



  • angular.version is only one object module in ng.
  • Angular version object is used to specify the information about the current AngularJS version.

angular.version object properties in AngularJS:

object Type Description
full string It describes the full version of the string.
major number It is used to specify the major version number.
minor number It is used to specify the minor version number
dot number It describes the dot version number.
codeName string It is used to specifies the code name of the release.

Syntax for angular.version Object in AngularJS:

var variablename=angular.version;

Sample code for angular.version Object in AngularJS:

 Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy AngularJS Tutorials</title>
        <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/
                    angular.min.js"></script>
    </head>
    <body>
        <div ng-app="myApp" ng-controller="myCtrl">
            <h3>angular.version object in AngularJS Tutorial</h3>
            <h4>Full Version = {{ value }}</h4>
            <h4>Minor Version Number ={{num}}</h4>
            <h4>Major Version Number={{num1 }}</h4>
            <h4>Dot Version Number={{ dotvalue}}</h4>
            <h4>Code Name={{name}}</h4>
        </div>
        <script>
            var app = angular.module('myApp', []);
            app.controller('myCtrl', function($scope) {
                var new1 = angular.version;
                $scope.value = new1.full;
                $scope.num=new1.minor;
                $scope.num1=new1.major;
                $scope.dotvalue=new1.dot;
                $scope.name=new1.codeName;
            });
        </script>
    </body>
</html>

Code Explanation for angular.version Object in AngularJS:

Code Explanation for AngularJS Version Object

  1. The ng-app specifies the root element <div> to define AngularJS application.
  2. ng-controller specifies the application controller in AngularJS the controller value is given as “myctrl”
  3. The “myCtrl” used to create the controller for the Application with argument $scope object.
  4. Here Create the angular.version object with the new1 variable.
  5. new1.full object is used to specify the current version of AngularJS(like 1.5.6)
  6. new1.major object is used to define the major version number(i.e. 1)
  7. new1.minor object is used to define the minor version number(i.e. 5)
  8. dot value is used to call the angular version object new1 and displays the dot version number (i.e. 6)
  9. $scope.name object is get the value from new1 object and it displays the code release name.

Sample Output for angular.version Object in AngularJS:

Sample Output for AngularJS Version Object

  1. The output displays the full version of the AngularJS.
  2. The output displays the major version number is 1.
  3. The output displays the minor number is 5.
  4. The output displays the dot number is 6.
  5. The output displays the release code name as “arrow-stingification”.



Related Searches to angularjs version object