title: Using expression in ngmodel in angular 1.2
body: <p>I am trying to show checkboxes checked or unchecked based on certain condition. for eg:</p>
  
  <pre><code>$scope.userRoles = {"grants" : [ 
      "Permission", 
      "View", 
      "Update", 
      "Delete"
  ]}
  </code></pre>
  
  <p>On the HTML part i have added the following code:</p>
  
  <pre><code>&lt;div ng-repeat="p in userRoles"&gt;
     &lt;input type="checkbox" ng-model="p.grants.indexOf('Delete') != -1?true:false"  ng-change="AddRemovePermission(p,'Delete')" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>If i use ng-checked instead of ng-model than it works fine, but i will not get 2 way binding with that. Also i know we cant use expressions like above in ng-model.
  Can anybody help on how this can be done. The only condition is if user has grants than the checkbox should be checked else not, and when clicked on checkbox it should be changed to checked or unchecked accordingly and gets added in the userRoles object. Cant use directive as well.</p>
  
  <p>Thanks.</p>