How can I show different alerts by using a if function which gets its variable from nodejs backend? In my html stands:
<div uib-alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">{{alert.msg}}</div>
in my AngularJS file:
$http.get('/test').then(function(result){
this.alerts = function(){
if(result.test != null){
[ { type: 'danger', msg: 'Test is false' }];
}else{
[ { type: 'success', msg: 'Test is right' }];
}
};
}
But this does not work. Can anyone help?