AngularJS Example
HTML
<link rel="stylesheet" href="https://raw.github.com/sciactive/pnotify/master/jquery.pnotify.default.css">
<script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
<script src="https://raw.github.com/sciactive/pnotify/master/jquery.pnotify.min.js"></script>
<div ng-app="builder">
<div ng-controller="TestCtrl">
<button class="btn" ng-click="notify()">Notify</button>
</div>
</div>
CSS
</style>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.css"/>
<style>
JavaScript
var app = angular.module('builder', []);
app.service('notifyService', function($compile) {
this.error = function(scope){
var errors = [{"text":"error1"},{"text":"error2"}];
var text = "";
for(var x = 0; x < errors.length; x++){
text += errors[x].text + "\n"
}
$.pnotify({title: 'title',
text: text,
type: 'error',
});
};
});
app.controller( 'TestCtrl', function TestCtrl($scope,notifyService) {
$scope.notify = function () {
notifyService.error($scope);
}
});