Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
  <div ng-controller="testCtrl">
    
    
    <form name="testForm">
    
           Test input is required  <strong>{{!testForm.$valid}}</strong><br>
          Items model value length should be > 1 <strong>{{!items.length}}</strong><br>
 
      
      
      <input type="text" ng-model="test" ng-required="true" />
      <button type="submit" ng-disabled="!testForm.$valid || !items.length">Button with || operator</button>
      
      <button type="submit" ng-disabled="!testForm.$valid && !items.length">Button with && operator</button>
    
    </form>
    
  </div>
</body>
</html>
 
var myApp = angular.module('myApp', []);
myApp.controller('testCtrl', function($scope){
  $scope.items = [];
  $scope.test = '';
  
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers