Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ng-bind-html for scope variable injection #4

Merged
merged 1 commit into from
Oct 27, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions src/scripts/ng-notify.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* @description
*
* This module provides any AngularJS application with a simple, lightweight
* system for displaying notifications of varying degree to it's users.
* system for displaying notifications of varying degree to it's users.
*
*/
var module = angular.module('ngNotify', []);
Expand Down Expand Up @@ -64,7 +64,7 @@
var tpl = $compile(
'<div class="ngn" ng-class="ngNotify.notifyClass">' +
'<span class="ngn-dismiss" ng-click="dismiss()">&times;</span>' +
'<span>{{ ngNotify.notifyMessage }}</span>' +
'<span ng-bind-html="ngNotify.notifyMessage"></span>' +
'</div>'
)(notifyScope);

Expand All @@ -74,7 +74,7 @@

/**
* Sets what type of notification do display, eg, error, warning, etc.
*
*
* @param {String} providedType - optional user provided type that will override our default value.
* @return {String} - the type that will be assigned to this notification.
*/
Expand All @@ -85,7 +85,7 @@

/**
* Sets the theme for a notification, eg, pure, pastel, etc.
*
*
* @param {String} providedTheme - optional user provided theme that will override our default value.
* @return {String} - the theme that will be assigned to this notification.
*/
Expand All @@ -96,7 +96,7 @@

/**
* Sets the position of the notification, eg, top or bottom.
*
*
* @param {String} providedPosition - optional user provided position that will override our default value.
* @return {String} - the position that will be assigned to this notification.
*/
Expand All @@ -107,7 +107,7 @@

/**
* Sets how long (in ms) to display the notification for.
*
*
* @param {Integer} providedDuration - optional user provided number of ms a fade lasts.
* @return {Integer} - the number of ms a fade on this notification will last.
*/
Expand All @@ -118,7 +118,7 @@

/**
* Sets our notification's sticky state, forcing the user to dismiss it when enabled.
*
*
* @param {Bool} providedSticky - boolean on whether or not sticky state should be enabled.
*/
var setSticky = function(providedSticky) {
Expand All @@ -140,7 +140,7 @@

/**
* Triggers our constructor to add our fade prototypes to our element.
*
*
* @param {Object} el - an element generated by our own template and bound to it's own scope.
* @return {Object} - our element along with new fade prototype methods.
*/
Expand All @@ -150,16 +150,16 @@

/**
* Our constructor that will allow us to invoke a fade on our element.
*
*
* @param {Object} el - an element generated by our own template and bound to it's own scope.
*/
fadeLib.fn = function(el) {
this.el = el;
};

/**
* Handles the fading functionality and the duration for each fade.
*
* Handles the fading functionality and the duration for each fade.
*
* @param {Integer} mode - used to trigger fade in or out, adds or subtracts opacity until visible or hidden.
* @param {Integer opacity - initial opacity for our element.
* @param {Integer} duration - how long the fade should take to complete, in ms.
Expand Down Expand Up @@ -187,8 +187,8 @@
el.css('display', 'none');
}

if (callback) {
callback();
if (callback) {
callback();
}
}
};
Expand All @@ -198,7 +198,7 @@

/**
* Triggers a fade in, opacity from 0 to 1.
*
*
* @param {Integer} duration - how long the fade should take to complete, in ms.
* @param {Function} callback - function to invoke once fade has completed.
*/
Expand All @@ -210,7 +210,7 @@

/**
* Triggers a fade out, opacity from 1 to 0.
*
*
* @param {Integer} duration - how long the fade should take to complete, in ms.
* @param {Function} callback - function to invoke once fade has completed.
*/
Expand All @@ -220,7 +220,7 @@

/**
* Dismisses our notification when called, attached to scope for ngCLick event to trigger.
*
*
*/
notifyScope.dismiss = function() {
el.fadeOut(500, function() {
Expand All @@ -230,21 +230,21 @@

/**
* Our template bound to it's own personal scope and receiving our fade protoype functions.
*
*
* @type {Object}
*/
var el = fadeLib(tpl);

/**
* Our primary object containing all public API methods and allows for all our functionality to be invoked.
*
*
* @type {Object}
*/
var notifyObject = {

/**
* Merges our user specified options with our default set of options.
*
*
* @param {Object} params - object of user provided options to configure notifications.
*/
config: function(params) {
Expand All @@ -254,9 +254,9 @@

/**
* Sets, configures and displays each notification.
*
*
* @param {String} message - the message our notification will display to the user.
* @param {String|Object|null} userOpt - optional parameter that contains the type or an object of options used to configure this notification.
* @param {String|Object|null} userOpt - optional parameter that contains the type or an object of options used to configure this notification.
*/
set: function(message, userOpt) {

Expand All @@ -283,7 +283,7 @@

var sticky = setSticky(userOpts.sticky);
var duration = setDuration(userOpts.duration);
var notifyClass = setType(userOpts.type) + ' ' +
var notifyClass = setType(userOpts.type) + ' ' +
setTheme(userOpts.theme) + ' ' +
setPosition(userOpts.position);

Expand All @@ -304,7 +304,7 @@
},

/**
* Allows a developer to manually dismiss a notification that may be
* Allows a developer to manually dismiss a notification that may be
* set to sticky, when the message is no longer warranted.
*/
dismiss: function() {
Expand All @@ -314,9 +314,9 @@
// User customizations...

/**
* Adds a new, user specified theme to our notification system
* Adds a new, user specified theme to our notification system
* that they can then use throughout their application.
*
*
* @param {String} themeName - the name for this new theme that will be used when applying it via configuration.
* @param {String} themeClass - the class that this theme will use when applying it's styles.
*/
Expand All @@ -328,7 +328,7 @@
/**
* Adds a new, user specified notification type that they
* can then use throoughout their application.
*
*
* @param {String} typeName - the name for this new type that will be used when applying it via configuration.
* @param {String} typeClass - the class that this type will use when applying it's styles.
*/
Expand Down