PageRenderTime 50ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/bower_components/angular-notify/README.md

https://gitlab.com/kppawlowski/lex
Markdown | 108 lines | 77 code | 31 blank | 0 comment | 0 complexity | 7caaf982648e0d5d6dd4c088f1858afb MD5 | raw file
  1. #angular-notify
  2. >A minimalistic (and extensible) notification service for Angular.
  3. [Live Demo](http://cgross.github.io/angular-notify/demo/)
  4. Supports IE 10, and recent versions of FF and Chrome.
  5. ## Getting Started
  6. Install with Bower or download the the files directly from the dist folder in the repo.
  7. ```bash
  8. bower install angular-notify --save
  9. ```
  10. Add `dist/angular-notify.js` and `dist/angular-notify.css` to your index.html.
  11. Add `cgNotify` as a module dependency for your module.
  12. ```js
  13. angular.module('your_app', ['cgNotify']);
  14. ```
  15. Then inject and use the `notify` service.
  16. ```js
  17. function myController($scope,notify){ // <-- Inject notify
  18. notify('Your notification message'); // <-- Call notify with your message
  19. notify({ message:'My message', templateUrl:'my_template.html'} );
  20. }
  21. ```
  22. ## Options
  23. ### notify(String|Object)
  24. The `notify` function can either be passed a string or an object. When passing an object, the object parameters can be:
  25. * `message` - Required. The message to show.
  26. * `duration` - Optional. The duration (in milliseconds) of message. A duration of 0 will prevent messages from closing automatically.
  27. * `templateUrl` - Optional. A custom template for the UI of the message.
  28. * `classes` - Optional. A list of custom CSS classes to apply to the message element.
  29. * `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>`).
  30. * `scope` - Optional. A valid Angular scope object. The scope of the template will be created by calling `$new()` on this scope.
  31. * `position` - Optional. `center`, `left` and `right` are the only acceptable values.
  32. * `container` - Optional. Element that contains each notification. Defaults to `document.body`.
  33. This function will return an object with a `close()` method and a `message` property.
  34. ### notify.config(Object)
  35. Call `config` to set the default configuration options for angular-notify. The following options may be specified in the given object:
  36. * `duration` - The default duration (in milliseconds) of each message. A duration of 0 will prevent messages from closing automatically.
  37. * `startTop` - The Y pixel value where messages will be shown.
  38. * `verticalSpacing` - The number of pixels that should be reserved between messages vertically.
  39. * `templateUrl` - The default message template.
  40. * `position` - The default position of each message. `center`, `left` and `right` are the supported values.
  41. * `container` - The default element that contains each notification. Defaults to `document.body`.
  42. * `maximumOpen` - The maximum number of total notifications that can be visible at one time. Older notifications will be closed when the maximum is reached.
  43. ### notify.closeAll()
  44. Closes all currently open notifications.
  45. ## Providing Custom Templates
  46. 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"`).
  47. 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.
  48. 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.
  49. ## Release History
  50. * v2.5.0 - 04/12/2015
  51. * New `duration` property per notification.
  52. * New `position` property per notification.
  53. * Fix for DOM elements not being removed.
  54. * New `maximumOpen` config option.
  55. * Bump Angular dependency to 1.3.
  56. * v2.0.2 - 09/06/2014
  57. * Default template redesigned with a Bootstrap look and feel. Default template now also includes a close button.
  58. * Default message location is now the top center.
  59. * Default message duration is now 10 seconds.
  60. * Default verticalSpacing is now 15px.
  61. * The `template` option was renamed to `templateUrl`.
  62. * New `messageTemplate` option added.
  63. * New `classes` option added.
  64. * Fixed an issue causing a message with multiple lines of text to be placed into the visible area too soon.
  65. * Fixed #4 (config() not correctly setting startTop)
  66. * v1.1.0 - 5/18/2014 - Added return value allowing for closing and updating of message.
  67. * v1.0.0 - 4/16/2014 - Significant refactoring.
  68. * JQuery is no longer a required dependency.
  69. * [Breaking Change] Configure the default template using `config()` now instead of the `cgNotifyTemplate` value.
  70. * [Breaking Change] The `verticalSpacing` parameter should no longer include the height of the notification element.
  71. * [Breaking Change] The `scope` options must now be a valid Angular scope.
  72. * [Breaking Change] The duration of the notifications is now based on a `duration` config property and does not rely on the delay attribute of the CSS transition.
  73. * Messages can now word wrap if you use a `max-width` css value.
  74. * The scope for templates now includes a `$close()` function.
  75. * New `notify.closeAll()` method.
  76. * v0.2.0 - Adding custom templates ability, fixed FF bug.
  77. * v0.1.0 - Initial release.