Thursday, November 14, 2013

diving into Angular

<form role="form" ng-init="search()" ng-submit="search()">

 
 

Above, upon both loading and submitting the form, we will run this function in the appropriate controller:

$scope.search = function() {
   $scope.statuses = whatever;
}

 
 

Farther down our view we may loop through our data like so:

<tr ng-repeat="state in statuses">
   <td>
      <a ui-sref="detail.whatever({stateId: state.id})">
         {{state.label}}
      </a>
   </td>
   <td>
      {{state.data}}
   </td>
   <td>
      {{state.percentage}}%
   </td>
</tr>

No comments:

Post a Comment