Angularjs 无法在UI引导中更改警报颜色
我正在尝试使用UI引导更改警报的颜色,类似于上的示例。但是当我使用下面的代码时,警报都是Angularjs 无法在UI引导中更改警报颜色,angularjs,twitter-bootstrap-3,angular-ui-bootstrap,Angularjs,Twitter Bootstrap 3,Angular Ui Bootstrap,我正在尝试使用UI引导更改警报的颜色,类似于上的示例。但是当我使用下面的代码时,警报都是警报警告颜色。有没有想过我做错了什么 HTML: 这里有一个您必须从中替换您的类型 <alert ng-repeat="alert in alertForm.alerts" type="{{alertForm.alert.type}}" close="closeAlert($index)" class="text-center">{{alert.msg}}</alert> 有趣的事实
警报警告
颜色。有没有想过我做错了什么
HTML:
这里有一个您必须从中替换您的类型
<alert ng-repeat="alert in alertForm.alerts" type="{{alertForm.alert.type}}" close="closeAlert($index)" class="text-center">{{alert.msg}}</alert>
有趣的事实alertForm.alerts.$index.type
也可以,但不如使用alert.type。事实上,alert
等于alertForm.alerts[$index]
。但是使用后者的可读性要差得多。无论出于什么原因,alert.type没有{{}}在以前的ui引导中工作,但在0.6中没有。请检查此项
.controller('AlertFormCtrl', function(){
var alertForm = this;
alertForm.alerts = [
{ type: 'default', msg: 'Please complete the fields below.' },
{ type: 'success', msg: 'Successfully submitted.' }
];
alertForm.addAlert = function() {
alertForm.alerts.push({type: 'danger', msg: 'Another alert!'});
};
alertForm.closeAlert = function(index) {
alertForm.alerts.splice(index, 1);
};
});
<alert ng-repeat="alert in alertForm.alerts" type="{{alertForm.alert.type}}" close="closeAlert($index)" class="text-center">{{alert.msg}}</alert>
<alert ng-repeat="alert in alertForm.alerts" type="{{alert.type}}" close="closeAlert($index)" class="text-center">{{alert.msg}}</alert>