alexcrack / angular-ui-notification Goto Github PK
View Code? Open in Web Editor NEWAngular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
License: MIT License
Angular.js service providing simple notifications using Bootstrap 3 styles with css transitions for animating
License: MIT License
Would be great if we could redirect via ui-router as well. Great module!
Notification.success({message: '<a ui-sref="my.route({url: urlParam})">click here to change ui-route</a>'});
First thank you for sharing your work. I really appreciate your coding. It is clean and easy to understand.
Bug/Feature: In your CSS you force "top" definition to '-100px' which prevents moving notification to bottom of the page. Moving to bottom while not available in config option is easy. You only have to replace "top" by "bottom" in line 58 of your script
element.css('bottom', top + 'px');
element.css('right', right + 'px');
Note: I do not use LESS but SCSS, I placed https://gist.github.com/fulup-bzh/d3fe7a5e537bc5a46e3d a SCSS version of your LESS file. It is exactly the same expect that I remove dependencies to BootStrap [I'm using F5].
Request: would be nice to have an option to place notification at bottom of the page without hacking your javascript.
Hi,
first of all, thanks for the nice package. It is exactly what I was looking for. Would it be possible to also provide this as an npm package? I am not using bower right now and it would be convenient to have this on the global npm registry as well. Meanwhile I have pushed it to a private npm repo which works for now.
Tobias.
It seems that the option startRight is ignored when used as so:
Notification.success({message : "txt", startRight: 100});
According to the doc:
"Options can be passed to configuration provider globally or used in the current message."
i don't know if it's a bug or documentation error, i let you see :)
hello
do this ui notification suport delay until ajax completed?
We use the component to display real time information notifications that don't really act as warning/info/error/... pop-ups. We had to change the CSS a bit to get the right colors and styling of the overall component, since we could not use the predefined icons and wanted to put some font awesome icons insted. An option to provide a custom template for the whole notification box would be great!
I am trying to do global configuration and running into errors. Here is a forked plunker.
http://plnkr.co/edit/HRTVD29hJVr74E1OFlma?p=preview
Am I doing something wrong?
Sometimes is nice to check first if the message you want to display was already added and is still active, to avoid duplicated messages. Either access to the array of active messages or a new option to accomplish so would be appreciated.
Thanks!
Using the min.js file and calling simply Notification.primary('Primary notification');
as shown in the example, but it gives following error.
ReferenceError: args is not defined
at Function.m.primary (http://localhost:9000/bower_components/angular-ui-notification/dist/angular-ui-notification.min.js:8:1568)
at new <anonymous> (http://localhost:9000/app/home/home.controller.js:6:16)
at invoke (http://localhost:9000/bower_components/angular/angular.js:4182:17)
at Object.instantiate (http://localhost:9000/bower_components/angular/angular.js:4190:27)
at http://localhost:9000/bower_components/angular/angular.js:8449:28
at http://localhost:9000/bower_components/angular-ui-router/release/angular-ui-router.js:3897:28
at invokeLinkFn (http://localhost:9000/bower_components/angular/angular.js:8213:9)
at nodeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7722:11)
at compositeLinkFn (http://localhost:9000/bower_components/angular/angular.js:7075:13)
at publicLinkFn (http://localhost:9000/bower_components/angular/angular.js:6954:30)
All other functions works just well.
I installed it from bower. The version I got is v0.0.2.
Most probably the problem is missing args as argument in primary function. Here is the current definition:
notify.primary = function() {
this(args, '');
};
It should have args as argument to the function. That might solve the problem. When I tried to do that it hanged my whole application saying "232VM1570:26054 WARNING: Tried to load angular more than once." and it goes infinitely loading process.
Hi,
I'd like to use Notification in my interceptor. It's seams that i can't because there is circular dependency problem:
$http <- Notification <- errorHttpInterceptor <- $http <- $templateRequest <- $compile
This is how i'm registering interceptor:
angular.module('myModule', [])
.config(function($httpProvider) {
$httpProvider.interceptors.push('errorHttpInterceptor');
});
angular
.module('myModule')
.factory('errorHttpInterceptor', function (Notification) {
return {
'responseError': handleErrorResponse
};
function handleErrorResponse(response) {
Notification.error('error');
}
Do you have any ideas?
I don't want the notifications to disappear when the user clicks on it.
Would it be possible to put this in options ?
Please, implement option to show "Close" button.
Thanks.
Hi Alex, great library. Unfortunately the Notification.clearAll() function is not working in IE 11.
it think this is becuase you are using element.remove() which is a helper method that is a part of DOM 4 and not supported in IE11.
You can easily resolve this by changing your element.remove to be:
element.parentNode.removeChild(element)
This is just what the DOm 4 helper does. I think this is hopefully an easy 'fix' that will make your great library more cross browser compatible.
thanks,
Albert
Here is a forked plunker with the issue.
I'm trying to fire notifications with the parameter: type
like this:
var messages = [];
messages.push({type:'error',content:'Error notification'});
messages.push({type:'info',content:'Info notification'});
messages.push({type:'primary',content:'Primary notification'});
messages.push({type:'success',content:'Success notification'});
angular.forEach(messages,function(message,key){
Notification({title:'test',type:message.type,message:message.content});
});
thank you
Plunkr demo here: http://plnkr.co/edit/VFcfYRe8jY53Mkup6UeK?p=preview
the issue is my inability to dynamically define where the notification will appear. Passing in different numbers for the "startTop" and "startRight" parameters do not affect where the notification appears (as seen in the plunkr example. In my application I need to make the notification appear in different places (to correspond with specific elements) but can not define the position through these (startTop, startRight) parameters. Simply using "positionX: 'center'" is not specific enough of a position.
Hello
First of all, I want to tell you I'm appreciate for your job this plugin works like a charm :)
Actually it worked like a charm until new release. Since 0.0.12 my custom templates aren't loaded. Everything works fine on 0.0.11.
Here is my code for debug purpose (template and call to notification):
<div class="ui-notification" custom-template>
<h3>{{ msgTitle }}</h3>
<div class="message">
{{ msgBody }}<br>
<a data-ng-show="someValue" href="a_link">Show Details</a>
<a data-ng-show="!someValue" href="a_link">Show Details</a>
</div>
</div>
var scope = $rootScope.$new(false);
scope.msgTitle = msg.notification.title;
scope.msgBody = msg.notification.body;
Notification.success({
delay: 5000,
template: "views/app/common/notification/template.html",
scope: scope,
replaceMessage: true
});
The notification starts all the way left and transitions to the correct final center position rather than starting there.
Hello! I would like to add an option to display a notification only if its not already displayed. Would you like me to write this?
Our use case is that we would like to have notifications with a delay for success and sticky notifications for errors. More people could be interested.
What do you think about adding a "per notification type" config?
Could we have notifications optionally centered at the top or bottom of the screen (as opposed to the existing left, and right options). Also, could the text within the notification be centered by default. Basically looking something like google apps notification that show up at the top center.
Thanks for the really useful module!
I have edited the css for the notications to fit into my page design, but I can't quite figure out how to get the javascript to play nicely with my media queries for my responsive design. I need the start position to be at top 70px on desktop and 80px on mobile. I can do this easily with CSS, but the js only has one start position to play with.
Also, I don't suppose there's an easy way to have it do something more like a jQuery slideDown rather than moving in from the top of the screen, is there? I'ds like to have it appear to slide out from under my top header. (wishful thinking :-) )
THANKS!
Our use case calls for a notification item that can be clicked on and then would call a function in our code (to show more details about the item using ngDialog). I tried adding ng-click handlers in the template, but the code never got called. It would be great if we could pass in some arguments in some way of course!
I get this error whenever I try to show a notification. For example running Notification.success('success');
. Is anyone else having this problem? Have I missed some part of the config?
Error: element.style is undefined
.css@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:3074:7
JQLite.prototype[name]@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:3201:9
this.$get/notify/<@https://localhost:8443/ext/angular-ui-notification.js:115:17
$http/promise.success/<@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:9954:11
processQueue@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:14437:28
scheduleProcessQueue/<@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:14453:27
$RootScopeProvider/this.$get</Scope.prototype.$eval@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:15702:16
$RootScopeProvider/this.$get</Scope.prototype.$digest@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:15513:15
$RootScopeProvider/this.$get</Scope.prototype.$apply@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:15807:13
done@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:10246:36
completeRequest@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:10418:7
requestLoaded@https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.0-rc.2/angular.js:10359:1
hello
i have no-timeout notification but after one event i need to close this , please help me how i can remove programmatically
The idea i suggest is to have a new parameter on configuration who is the max number of notification displayed on the screen. We can imagine that when max number is reach, the oldest notifications are replaced with the new one.
I am having this exact same issue: #29
I tried the code and I did not have any success.
angular.module('ui', [])
.config(function($httpProvider) {
$httpProvider.interceptors.push('baseHttpInterceptor');
})
.factory('baseHttpInterceptor', function ($injector) {
var Notification = $injector.get('Notification');
return {
'responseError': function() {
Notification.error('Oops');
}
};
});
Circular dependency error:
Circular dependency found:
$compile <- Notification <- baseHttpInterceptor <- $http <- $templateRequest <- $compile
Any ideas?
Are you planning add Glyphicons from Bootstrap?
I run:
bower install angular-ui-notification --save
And I get the following bower messages:
bower not-cached git://github.com/alexcrack/angular-ui-notification.git#*
bower resolve git://github.com/alexcrack/angular-ui-notification.git#*
bower download https://github.com/alexcrack/angular-ui-notification/archive/v0.0.14.tar.gz
bower extract angular-ui-notification#* archive.tar.gz
bower mismatch Version declared in the json (0.0.12) is different than the resolved one (0.0.14)
bower resolved git://github.com/alexcrack/angular-ui-notification.git#0.0.14
bower install angular-ui-notification#0.0.14
bower no-json No bower.json file to save to, use bower init to create one
And the dist folder is empty.
How to solve this problem?
The version of my Bower is 1.6.3.
Grateful.
I might be missing something but it seems that the scope created for each notification (var scope = args.scope.$new();
) is never destroyed.
Is there a way to properly cleanup the scope when the template element is removed ?
Is there any way to provide a controller for the notification and use angular directives in the template?
On Tag 0.0.14 version specified on bower.json is mismatched. It says 0.0.12 instead on 0.0.14. Because of this fact, this error is generated:
*** [err :: xxxx.com] bower angular-ui-notification#~0.0.14 mismatch Version declared in the json (0.0.12) is different than the resolved one (0.0.14)
Can you help me find out why custom template doesn't work ?
I am calling the service this way
Notification({message: 'Hello', delay: 10000, templateUrl: 'main/notification-template.html'})
My html file is in the templates folder.
A notification appears, but with the default template.
Hey there,
By default the service looks for the notification template at '/angular-ui-notification.html'.
How do we go about setting this value in our app with a custom template URL?
Thanks,
Luke
I think would be nice if Notification could return a object with it's configuration, methods, etc..
I would like to kill a notification if a ajax request is done. To this date there's no way to do this.
The necessary modification (draft) is proposed at https://github.com/alexcrack/angular-ui-notification/compare/master...enapupe:returnNotification?expand=1
Do you think this improvement is possible?
An example of use would be:
var test = Notification("Refreshing.....");
SomeService.regenerateAPIKey().then(function(){
Notification("API Key sucessfully regenerated.");
test.then(function(notification){
notification.kill(true);
});
});
The fact that explicit dependency injection is not used for the provider in the source file is causing problems when using browserify & ng-annotate, which is blocking.
It requires the provider to be created with:
this.$get = ['$timeout', '$http', '$compile', '$templateCache', '$rootScope', '$injector', '$sce', '$q', '$window',
function($timeout, $http, $compile, $templateCache, $rootScope, $injector, $sce, $q, $window) {
...
}
]
It is done in your minified file but the source file is used with browserify.
Just wanted to know if there is a way to do this.
I would like the icons within my custom notifications to be different for error
, warning
and success
types however I see no way of doing that other that passing in the icon html with the message or creating a new scope to pass in.
Is there a way to check the notification "type" inside a custom template?
It took a while before I saw this, but, once my notifications are hidden (they even get the class 'killed', they stay in the dom.
Hovering with the mouse makes them visible again..
I saw in the demo (they are removed from the dom after a short while).
Tried to find the piece of code that removes them from the DOM, but can't find it.
Am I forgetting something?
I want to get the updated and patched version (merged by pull request)
Hello,
I would like to use angular-ui-notification inside a exceptionHandler like here:
http://stackoverflow.com/a/16942964/3894981
Instead of alert(...)
I would like to use Notification.error(...)
.
However this causes an error:
https://docs.angularjs.org/error/$injector/cdep?p0=$rootScope%20%3C-%20$timeout%20%3C-%20Notification%20%3C-%20$exceptionHandler%20%3C-%20$rootScope%20%3C-%20$translate
What is the workaround to use this extension to show error messages to the user?
Great job you had done. I really like it. I found out the notification will show and fade out, but while I move my mouse pointer around, these notifications will show up. And I need to click one after one to make these history notifications go away.
I notice that when notifications fade out, they do that via the 'killed' class which sets their opacity to 0. But I don't see anything in the code which removes those elements from the DOM. I think invisible notifications will accumulate indefinitely, bloating the DOM. Seems like there should be a periodic mechanism to cull out these old elements, removing the from the DOM entirely.
If I use position : 'bottom', the alert tries to fill the entire column.
The alert text is not shown at all.
Would you public your last changes to bower, so using it i can download the version wich implements custom positioning of the notifications?
This would come handy for handling expiry of different notifications.
For delay
option description Readme says: Number of ms before notification fades out. If not an integer, notification will persist until killed.
I tried setting it to non numerical value both, for a single message and in global options, but the message dissapears immediately. See plunker: http://plnkr.co/edit/4WKNdPOieAOzFJLQbOju?p=preview
Is it possible to configure the postion of angular ui notifications?
Hi,
I tried to install using bower with the following command:
bower install angular-ui-notification --save
It looks like that your bower.json file in not valid anymore, i get the following error message:
Additional error details:
The "main" field cannot contain minified files
Regards
Tobias
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.