|
1 | 1 | /**
|
2 | 2 | * @ngdoc directive
|
3 |
| - * @name patternfly.notification.directive:pfToastNotificationList |
4 |
| - * @restrict A |
| 3 | + * @name patternfly.notification.component:pfToastNotificationList |
| 4 | + * @restrict E |
5 | 5 | * @scope
|
6 | 6 | *
|
7 |
| - * @param {Array} notifications The list of current notifcations to display. Each notification should have the following (see pfToastNotification): |
| 7 | + * @param {Array} notifications The list of current notifications to display. Each notification should have the following (see pfToastNotification): |
8 | 8 | * <ul style='list-style-type: none'>
|
9 | 9 | * <li>.type - (String) The type of the notification message. Allowed value is one of these: 'success','info','danger', 'warning'
|
10 | 10 | * <li>.header - (String) The header to display for the notification (optional)
|
|
25 | 25 | * @param {function} updateViewing (function(boolean, data)) Function to invoke when user is viewing/not-viewing (hovering on) a toast notification
|
26 | 26 | *
|
27 | 27 | * @description
|
28 |
| - * Using this directive displayes a list of toast notifications |
| 28 | + * Using this component displayes a list of toast notifications |
29 | 29 | *
|
30 | 30 | * @example
|
31 | 31 | <example module="patternfly.notification">
|
32 | 32 |
|
33 | 33 | <file name="index.html">
|
34 | 34 | <div ng-controller="ToastNotificationListDemoCtrl" >
|
35 |
| - <div pf-toast-notification-list notifications="notifications" show-close="showClose" close-callback="handleClose" update-viewing="updateViewing"></div> |
| 35 | + <pf-toast-notification-list notifications="notifications" show-close="showClose" close-callback="handleClose" update-viewing="updateViewing"></pf-toast-notification-list> |
36 | 36 | <div class="row example-container">
|
37 | 37 | <div class="col-md-12">
|
38 | 38 | <form class="form-horizontal">
|
|
201 | 201 |
|
202 | 202 | </example>
|
203 | 203 | */
|
204 |
| -angular.module('patternfly.notification').directive('pfToastNotificationList', function () { |
205 |
| - 'use strict'; |
| 204 | +angular.module('patternfly.notification').component('pfToastNotificationList', { |
| 205 | + bindings: { |
| 206 | + notifications: '=', |
| 207 | + showClose: '=?', |
| 208 | + closeCallback: '=?', |
| 209 | + updateViewing: '=?' |
| 210 | + }, |
| 211 | + templateUrl: 'notification/toast-notification-list.html', |
| 212 | + controller: function () { |
| 213 | + 'use strict'; |
| 214 | + var ctrl = this; |
206 | 215 |
|
207 |
| - return { |
208 |
| - restrict: 'A', |
209 |
| - scope: { |
210 |
| - notifications: '=', |
211 |
| - showClose: '=?', |
212 |
| - closeCallback: '=?', |
213 |
| - updateViewing: '=?' |
214 |
| - }, |
215 |
| - templateUrl: 'notification/toast-notification-list.html', |
216 |
| - controller: function ($scope) { |
217 |
| - $scope.handleClose = function (notification) { |
218 |
| - if (angular.isFunction($scope.closeCallback)) { |
219 |
| - $scope.closeCallback(notification); |
220 |
| - } |
221 |
| - }; |
222 |
| - $scope.handleViewingChange = function (isViewing, notification) { |
223 |
| - if (angular.isFunction($scope.updateViewing)) { |
224 |
| - $scope.updateViewing(isViewing, notification); |
225 |
| - } |
226 |
| - }; |
227 |
| - } |
228 |
| - }; |
| 216 | + ctrl.handleClose = function (notification) { |
| 217 | + if (angular.isFunction(ctrl.closeCallback)) { |
| 218 | + ctrl.closeCallback(notification); |
| 219 | + } |
| 220 | + }; |
| 221 | + ctrl.handleViewingChange = function (isViewing, notification) { |
| 222 | + if (angular.isFunction(ctrl.updateViewing)) { |
| 223 | + ctrl.updateViewing(isViewing, notification); |
| 224 | + } |
| 225 | + }; |
| 226 | + } |
229 | 227 | });
|
0 commit comments