角带显示错误列表

时间:2016-01-28 00:43:08

标签: angularjs angular-strap

是否有可能在角带警报或html中显示错误列表(逗号分隔数组)?

我没有办法做到这一点。

$scope.errors = response.split(',');

var myAlert = $alert({
title: 'title',
content: '-----------',
placement: 'top',
type: 'success',
duration: '1',
show: true
});

1 个答案:

答案 0 :(得分:1)

由于该数组是用逗号分隔的字符串创建的...只需传入原始字符串

var myAlert = $alert({
    title: 'title',
    content: response,
    placement: 'top',
    type: 'success',
    duration: '1',
    show: true
});

或者使用$scope.errors.join(', ');

进行更多分离