我需要点击按钮将每个输入的背景颜色变为绿色:
http://jsfiddle.net/coma/jst7cfgb/
逻辑
app.run(function($rootScope) {
$rootScope.change = function () {
$rootScope.data = {
email: 'foo@foo.coo',
name : 'foo'
};
};
});
查看
<button ng-click="change()">Paint them green!</button>
<form name="form">
<input type="email" ng-model="data.email"/>
<input type="name" ng-model="data.name"/>
</form>
风格
input.ng-dirty {
background-color: #53ed9a;
}
备注