AngularJS でサービスを作成しました。
services.service('Alerts', function($rootScope, $timeout) {
this.add = function(content) {
$rootScope.alerts.push({
content: content
});
$timeout(function () {
$rootScope.alerts.pop();
console.log($rootScope.alerts[0]);
}, 1000);
}
}).run(function($rootScope) {
$rootScope.alerts = [];
});
私のHTMLコードを実装しました:
<div class="alerts">
<div class="alert fade" ng-repeat="alert in alerts" bs-alert="alert"></div>
</div>
それは完全にうまくフェードインしますが、1秒後にテーブルから単純に「ポップ」するのではなく、要素を取得してから element.fadeOut() (jquery) を使用したいと思います
実際のアラート要素を取得できません。