Я написал директиву, чтобы показать уведомление в некоторой области: github.io/angular-strap/#/alerts) служба предупреждений не добавляет предупреждения в мой контейнер директив, почему?
app.directive("notification", function ($alert, $rootScope) {
return {
restrict: "E",
template: '<div></div>',
link: function (scope, element) {
var id = "#alerts-container" + getRandomId();
element.attr("id", id);
scope.$on('notificationEvent', function (event, alertArg) {
var alert = angular.extend(alertArg, {container: id});
console.log(alert);
$alert(alert);
event.preventDefault();
});
}
};
});
Страница:
<notification>
</notification>
Все события обрабатываются, ошибок во время выполненияnotificationEvent нет, но мой контейнер уведомлений всегда пуст. Не могли бы вы помочь мне?
Благодарю вас!