AngularJs动态增减class样式——ng-class
来源:互联网 发布:生意参谋免费版 知乎 编辑:程序博客网 时间:2024/04/30 00:22
使用ng-class可以实现动态地增减样式:
<!DOCTYPE html><html ng-app="formExample"><head> <meta charset="UTF-8"> <title></title> <script src="../js/angular.js"></script> <script> angular.module('formExample', []) .controller('FormController', ['$scope', function($scope) { }]); </script> <style> .strike { text-decoration: line-through; } .bold { font-weight: bold; } .red { color: red; } </style></head><body><div> <p ng-class="{strike: deleted, bold: important, red: error}">通过映射的方式</p> <input type="checkbox" ng-model="deleted">添加strike样式<br> <input type="checkbox" ng-model="important">添加bold样式<br> <input type="checkbox" ng-model="error">添加错误样式 <hr> <p ng-class="style">使用字符串的方式</p> <input type="text" ng-model="style" placeholder="输入 bold、 strike 或 red"> <hr> <p ng-class="[style1, style2, style3]">使用数组的方式</p> <input ng-model="style1" placeholder="输入: bold, strike 或 red"><br> <input ng-model="style2" placeholder="输入: bold, strike 或 red"><br> <input ng-model="style3" placeholder="输入: bold, strike 或 red"><br> <hr/></div></body></html>
0 0
- AngularJs动态增减class样式——ng-class
- angularJs中的ng-class动态改变样式
- AngularJS ng-class样式切换
- AngularJS——ng-class
- 使用ng-class 动态修改样式
- AngularJS ng-class
- AngularJS ng-class用法
- AngularJs----ng-class
- AngularJS ng-class用法
- angularjs ng-class
- AngularJS之ng-class
- AngularJS ng-class
- angularJS之ng-class
- angularjs-ng-class指令
- ng-class切换样式
- angularJS 中html 标签绑定样式,ng-class的使用
- Angular—ng-class
- 关于AngularJS的ng-class
- 实现android的 google第三方登陆!
- iOS 应用内付费(IAP)开发步骤一:填写相关的税务,银行,联系人信息;
- Java Web项目中web.xml中默认首页访问的是:WebContent目录下的文件
- 真正的成长
- Gonet2 游戏服务器框架解析之Agent(3)
- AngularJs动态增减class样式——ng-class
- ubuntu切换中文语言
- 怎样在几何画板中调节相交圆
- 苹果审核reject理由大全(4):话费、Metadata Rejected
- web service开发2
- HDU1260 Tickets
- ndroid-support-v7-appcompat调用报错
- tomcat优化二
- cocos图显示不出来,怀疑是太长了.然后百度了下各个硬件平台的限制