lundi 14 novembre 2016

show different uib-alerts by using a if function ANGULARJS

How can I show different alerts by using a if function. In my html stands:

<div uib-alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)"></div>

in my AngularJS file:

var test = false;

      this.alerts =   function(){
    if(test = false{
              [  { type: 'danger', msg: 'Test is false' }];
    }else{
    [  { type: 'success', msg: 'Test is right' }];
            }
          };  

But this does not work. Can anyone help?

Aucun commentaire:

Enregistrer un commentaire