| 41 | // message in the alert. If an Object, "title" will be bolded, "message" |
| 42 | // will be normal font weight, and "bullets" will be rendered as a list. |
| 43 | function alert(type, messageOrOptions) { |
| 44 | var alertObject; |
| 45 | |
| 46 | if (angular.isObject(messageOrOptions)) { |
| 47 | alertObject = angular.copy(messageOrOptions); |
| 48 | alertObject.type = type; |
| 49 | } else { |
| 50 | alertObject = { |
| 51 | message: messageOrOptions, |
| 52 | type: type |
| 53 | }; |
| 54 | } |
| 55 | |
| 56 | alertObject.id = nextId; |
| 57 | nextId += 1; |
| 58 | return nextAlerts.push(alertObject); |
| 59 | } |
| 60 | |
| 61 | this.danger = function(messageOrOptions) { |
| 62 | return alert(TYPE_DANGER, messageOrOptions); |