运行 ❯
获取您的
自有
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <body ng-app=""> My favorite topic is: <select ng-model="myVar"> <option value="dogs">Dogs <option value="tuts">Tutorials <option value="cars">Cars </select> <hr> <div ng-switch="myVar"> <div ng-switch-when="dogs"> <h1>Dogs</h1> <p>Welcome to a world of dogs.</p> </div> <div ng-switch-when="tuts"> <h1>Tutorials</h1> <p>Learn from examples.</p> </div> <div ng-switch-when="cars"> <h1>Cars</h1> <p>Read about cars.</p> </div> <div ng-switch-default> <h1>Switch</h1> <p>Select topic from the dropdown, to switch the content of this DIV.</p> </div> </div> <hr> <p>The ng-switch directive hides and shows HTML sections depending on a certain value.</p> </body> </html>