title: Why do i need to create an object, any advantage here ng-controller="InvoiceController as invoice"
body: <p>as i am in learning stage of angularjs i am tring to understand each and every thing, so here is a some doubt, that i would like to ask.
  Consider the code:</p>
  
  <pre><code>&lt;div ng-controller="InvoiceController as invoice"&gt;
  &lt;b&gt;Invoice:&lt;/b&gt;
  &lt;div&gt;
     Quantity: &lt;input type="number" ng-model="invoice.qty" required &gt;
  &lt;/div&gt;
  &lt;div&gt;
     Costs: &lt;input type="number" ng-model="invoice.cost" required &gt;
     &lt;select ng-model="invoice.inCurr"&gt;
        &lt;option ng-repeat="c in invoice.currencies"&gt;{{c}}&lt;/option&gt;
     &lt;/select&gt;
  &lt;/div&gt;
  ....
  &lt;/div&gt;
  </code></pre>
  
  <p>Since, angular is javascript code which runs on user browser, So it really required to create an instance of a controller and then with the object we have to handle.</p>
  
  <pre><code>&lt;div ng-controller="InvoiceController as invoice"&gt;
  ..
  </code></pre>
  
  <p><strong><code>invoice.qty</code></strong> etc...</p>
  
  <p>Hope you have understood, what i am tring to ask.
  All i need to know is, by doing this kind of object creation (object oriented), do we get any advantage in client side programming language.</p>
  
  <p>reference : <a href="http://docs.angularjs.org/guide/concepts#model" rel="nofollow">http://docs.angularjs.org/guide/concepts#model</a> in "Adding UI logic: Controllers" section</p>