AngularJS Example

by choroshin

HTML

<div ng-app="App">
    <div ng-controller="ctrl">

        <select ng-model="newItem.financial_year_id" required style="min-width:180px;">
   <option ng-repeat="financial in account_year" value="{{financial.id}}" ng-selected="financial.status=='Active'">{{financial.financial_year}}</option>
</select>
        
        
       
        
      </div>
</div>

CSS

</style> <!-- Ugly Hack to make remote files preload in jsFiddle --> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js"></script>
<style>

JavaScript

angular.module('App', []);

function ctrl($scope){
    $scope.newItem={};
    $scope.account_year=[{id:1,financial_year:"2013-2014",status:"Active"},
                         {id:2,financial_year:"2014-2015",status:"Inactive"}] 
    $scope.newItem.financial_year_id=$scope.account_year[0].id;
  
}