1 <!DOCTYPE HTML>2 <HTMLNg-app= "ConsoleApp">3 <HeadLang= "en">4 <MetaCharSet= "UTF-8">5 <title>MyTest</title>6 </Head>7 <BodyNg-controller= "Appctrl" >8 9 <inputtype= "checkbox"Ng-model= "Che"Ng-change= "Change ()"/>Ten One <DivNg-switch on= "EIP"> A <spanNg-switch-when= "Checked">1</span> - <spanNg-switch-when= "Add">2</span> - <spanNg-switch-when= "Add1">3</span> the </Div> - - </Body> - + <Scriptsrc= "Angular.js"></Script> - <Script> + varConsoleApp=Angular.module ('ConsoleApp',[]); A Consoleapp.controller ('Appctrl',['$scope',function($scope) { at - - if($scope. Che===undefined) { - $scope. EIP= 'add1'; - }Else if($scope. Che=== true){ - $scope. EIP= 'checked'; in }Else if($scope. Che=== false){ - $scope. EIP='Add' to } + - $scope. change= function(){ the if($scope. Che==='Undefind'){ * $scope. EIP= 'add1'; $ }Else if($scope. Che=== true){Panax Notoginseng $scope. EIP= 'checked'; - }Else if($scope. Che=== false){ the $scope. EIP='Add' + } A } the }]) + </Script> - </HTML>
AngularJs Ng-switch