- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 01:53 PM
I see the code in /scripts/js_includes_sp.jsx. I'd like to modify the function addNotification() in the Angular directive spNotifications so that non-trivial messages don't fade away.
Is there a way to change or extend the JavaScript?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-28-2016 06:56 PM
I discovered that decorating the directive spNotifications allows you to extend or overwrite the directive any way you want. In this case, I overrode two controller functions:
/* Override spNotificationsDirective controller */
angular.module('sn.$sp').config(function($provide) {
$provide.decorator('spNotificationsDirective', function($delegate, $controller) {
var controllerName = directive.controller;
directive.controller = function($scope) {
var controller = $controller(controllerName, {$scope: $scope});
// Override functions getMilliSeconds and areTrivial
controller.getMilliSeconds = function() {
var seconds = (areTrivial(controller.notifications)) ? 10 : 3000;
return input.length >= 1 && input.every(function(item) {
return item && item.type === 'trivial';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2019 01:30 AM
Hi,
We recently upgraded to Madrid and this script which was working fine has now broken with an error:
Error: [$injector:unpr] Unknown provider
Could anybody figure out how to fix this error? We have logged a call with HI and they have simply pointed us to the error but have provided no solution.
Thanks all
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2019 01:33 AM
Hello Aaron,
We also upgraded to Newyork, and this script throwing the 'Error: [$injector:unpr] Unknown provider: $elementProvider <- $element'. Did you get any workaround to fix this error? Pls assist if you find any info on this.
Thanks & Regards,
Indira Priya Darsini M.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2019 07:45 PM
London release added a new property that might be able to help:
https://hi.service-now.com/kb_view.do?sysparm_article=KB0713722