angular-ui-notification icon indicating copy to clipboard operation
angular-ui-notification copied to clipboard

maxcount is not working

Open fidelove opened this issue 8 years ago • 6 comments

I have configured the param maxcount, but it seems not to be working.

Looking into the code seems like only the default value is used.

Thanks in advance

fidelove avatar Sep 29 '16 10:09 fidelove

do you change this.options = { delay: 2000, startTop: 10, startRight: 10, verticalSpacing: 10, horizontalSpacing: 10, positionX: 'center', positionY: 'top', replaceMessage: false, templateUrl: 'angular-ui-notification.html', onClose: undefined, closeOnClick: true, maxCount: 2, // 0 - Infinite container: 'body' }; the param: "maxCount"? My project works well with angularjs 1.4.6

zygmcc avatar Oct 03 '16 05:10 zygmcc

the param: "maxCount" default is 0, means infinite

zygmcc avatar Oct 03 '16 05:10 zygmcc

Hello,

I have injected the parameters in the notification constructor:

 Notification.primary({
 templateUrl: 'partials/notification.html',
 scope: $notifScope,
 delay: notification.displayTime,
 positionY: notification.yPosition,
 positionX: notification.xPosition,
 maxCount: notification.maxCount, 
 onClose: function() {
      console.log('Close Notification');
 }

notification is an object received from the back, and it is correctly initialised with all the requested values.

May the problem come from transpilation from TypeScript to javascript?

As workaround I manually check the number of displayed notifications.

Thanks in advance and best regards.

fidelove avatar Oct 06 '16 07:10 fidelove

@fidelove your "notification" object came from an Angular promise? If so , try to use synchronization way instead of asynchronous

zygmcc avatar Oct 06 '16 07:10 zygmcc

I was doing some tests and despite the documentation in this link that says

Options can be passed to configuration provider globally or used in the current message.

Some options only work in the configuration of the provider like :

.config(function(NotificationProvider)` {
        NotificationProvider.setOptions({
            delay: 10000,
            maxCount: 5
        });

A working example can be found here

But I realy would like to see it working as a message parameter, because in my case, depending on the situation, I need to show it with differents numbers. Exemplo: Top-Right stack in 15 itens and Bottom-Right stack in 3.

Some one can confirm if this is the expected behavior? There is some way that I can achieve the discribed exemple?

RodrigoPetter avatar Aug 08 '17 21:08 RodrigoPetter

This is not working if I should change maxCount dynamically. I'm incredibly upset. I will fork this repo for make a fix. So, this code should work, but no:

abstract: true,
controllerAs: 'vm',
onEnter: function() {
     NotificationProvider.setOptions({
            maxCount: 99
     });
  },
onExit: function() {
   NotificationProvider.setOptions({
           maxCount: 3
    });
}

n-lavrenko avatar Aug 11 '18 01:08 n-lavrenko