Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@cgross/angular-notify
Advanced tools
#angular-notify
A minimalistic (and extensible) notification service for Angular.
Supports IE 10, and recent versions of FF and Chrome.
Install with Bower or download the the files directly from the dist folder in the repo.
bower install angular-notify --save
Add dist/angular-notify.js
and dist/angular-notify.css
to your index.html.
Add cgNotify
as a module dependency for your module.
angular.module('your_app', ['cgNotify']);
Then inject and use the notify
service.
function myController($scope,notify){ // <-- Inject notify
notify('Your notification message'); // <-- Call notify with your message
notify({ message:'My message', templateUrl:'my_template.html'} );
}
The notify
function can either be passed a string or an object. When passing an object, the object parameters can be:
message
- Required. The message to show.duration
- Optional. The duration (in milliseconds) of message. A duration of 0 will prevent messages from closing automatically.templateUrl
- Optional. A custom template for the UI of the message.classes
- Optional. A list of custom CSS classes to apply to the message element.messageTemplate
- Optional. A string containing any valid Angular HTML which will be shown instead of the regular message
text. The string must contain one root element like all valid Angular HTML templates (so wrap everything in a <span>
).scope
- Optional. A valid Angular scope object. The scope of the template will be created by calling $new()
on this scope.position
- Optional. center
, left
and right
are the only acceptable values.container
- Optional. Element that contains each notification. Defaults to document.body
.This function will return an object with a close()
method and a message
property.
Call config
to set the default configuration options for angular-notify. The following options may be specified in the given object:
duration
- The default duration (in milliseconds) of each message. A duration of 0 will prevent messages from closing automatically.startTop
- The Y pixel value where messages will be shown.verticalSpacing
- The number of pixels that should be reserved between messages vertically.templateUrl
- The default message template.position
- The default position of each message. center
, left
and right
are the supported values.container
- The default element that contains each notification. Defaults to document.body
.maximumOpen
- The maximum number of total notifications that can be visible at one time. Older notifications will be closed when the maximum is reached.Closes all currently open notifications.
Angular-notify comes with a very simplistic default notification template. You are encouraged to create your own template and style it appropriate to your application. Templates can also contain more advanced features like buttons or links. The message templates are full Angular partials that have a scope (and a controller if you use ng-controller="YourCtrl"
).
The scope for the partial will either be descended from $rootScope
or the scope specified in the notify({...})
options. The template scope will be augmented with a $message
property, a $classes
property, and a special $close()
function that you may use to close the notification.
The messageTemplate
property is also included on the scope as $messageTemplate
. To ensure your custom template works with the messageTemplate
option, your template should hide the normal text if $messageTemplate
contains a value, and should have an element with the cg-notify-message-template
class. The element with the cg-notify-message-template
class will have the compiled template appended to it automatically.
duration
property per notification.position
property per notification.maximumOpen
config option.template
option was renamed to templateUrl
.messageTemplate
option added.classes
option added.config()
now instead of the cgNotifyTemplate
value.verticalSpacing
parameter should no longer include the height of the notification element.scope
options must now be a valid Angular scope.duration
config property and does not rely on the delay attribute of the CSS transition.max-width
css value.$close()
function.notify.closeAll()
method.FAQs
A minimalistic notification service for angular.
We found that @cgross/angular-notify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.