How to call function before its definition in angularjs
<p>I want to use function before it definition. Because some time there will be lot of initialization variable, So I want to look my code very arrange, but if we call function after definition, my code does not looks fine, <strong>I know it is not possible in C/C++. But If in angularjs it is possible some how, please tell.</strong> </p>

<p>Please see some java-script code</p>

<pre><code>&lt;body&gt;
&lt;div ng-app="myApp" ng-controller="myCtrl"&gt;

First Name: &lt;input type="text" ng-model="firstName"&gt;&lt;br&gt;
Last Name: &lt;input type="text" ng-model="lastName"&gt;&lt;br&gt;
&lt;br&gt;
Full Name: {{firstName + " " + lastName}}

&lt;/div&gt;

&lt;script&gt;
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
    $scope.printName();// No working
    $scope.printName=function(){
      $scope.firstName = "John";
      $scope.lastName = "Doe";
    }
    //$scope.printName();// working
});
&lt;/script&gt;

&lt;/body&gt;
</code></pre>

<p>Following code is working, But my requirement is as above, I defined function like <code>$scope.printName=function(){}</code> because this function is use in views as ng-click. </p>

<pre><code> printName();// working
    function printName(){
      $scope.firstName = "John";
      $scope.lastName = "Doe";
    }
</code></pre>

<p>Please see the demo <a href="http://plnkr.co/edit/9HKXqWxDGi4ueXQYNhHe?p=preview" rel="nofollow">Pluker</a></p>