Binding inside ng-switch

by davekr

HTML

<script src="http://code.angularjs.org/1.0.1/angular-1.0.1.js"></script>
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div ng-controller="MyCtrl">
    <input ng-model="foo"> 
    <br/>
    <strong>Foo: {{foo}}</strong>
    <br/>
    <div ng-switch on="type">
        <div ng-switch-when="text">
             <strong>inside ng-switch:</strong> 
             <input ng-model="foo" type="text">
        </div>
    </div>
</div>

JavaScript

var myModule = angular.module('myModule', []).controller('MyCtrl', ['$scope', function($scope) {
    $scope.foo = 'Hello!';
    $scope.type= 'text';
}]);