AngularJS Live Example

by maxisam

HTML

<div ng:app>
 <form name="myForm" ng-controller="Ctrl">
 Inputs inside switch:
 <span data-ng-switch="show">
     <input data-ng-switch-when="true" type="text" data-ng-model="theField" />
 </span>
     <br/>
 Inputs outside of switch:
 <input type="text" data-ng-model="theField" />
     <br/>
 Values:
 {{theField}}
 </form>
</div>

CSS

</style>
<script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
<style>

JavaScript

function Ctrl($scope) {
  $scope.show = true;
  $scope.theField = 'hello';
}