效果:
导入的包:
angular-1.3.0.js
代码:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>颜色</title> <script type="text/javascript" src="angular-1.3.0.js"></script> <style> .sky{ background-color: blueviolet; } .tomato{ background-color: brown; } </style> </head> <body ng-app=""> <p>选择一个颜色</p> <select ng-model="world"> <option value="sky">紫色</option> <option value="tomato">深红色</option> </select> <div ng-class="world"> <h1>Hello World</h1> </div> </body>