
app.js.ekathuwa.js Maven / Gradle / Ivy
The newest version!
/**
* ekathuwa
* @version v0.1.3 - 2013-10-29
* @link https://github.com/sarath2/ngEkathuwa
* @author Sarath Ambegoda
* @license MIT License, http://www.opensource.org/licenses/MIT
*/
(function (window, document, undefined) {
'use strict';
angular.module('ngEkathuwa', []);
angular.module('ngEkathuwa', []).run([
'$rootScope',
'$ekathuwa',
function ($rootScope, $ekathuwa) {
$rootScope.$ekathuwa = $ekathuwa;
}
]).provider('$ekathuwa', function () {
this.$get = [
'$compile',
'$rootScope',
'$timeout',
'$q',
function ($compile, $rootScope, $timeout, $q) {
this.modal = function (op) {
var d = {
id: 'ekathuwaModalID',
scope: $rootScope.$new(),
controller: null,
backdrop: true,
keyboard: true,
remote: false,
show: true,
modalClass: 'fade',
role: 'dialog',
contentStyle: null,
contentCustomSize: 0,
contentPreSize: 'df',
templateURL: null,
templateHTML: null,
bodyTemplateURL: null,
bodyTemplate: null,
header: true,
headerText: null,
headerClass: '',
headerTemplate: null,
headerCloseBtn: true,
footer: true,
footerClass: '',
footerTemplate: null,
footerCloseBtn: true,
footerSaveBtn: false
};
var t = '', s = '', c = '', b = '', f = '', h = '';
op = angular.extend(d, op);
var btOPs = {
backdrop: op.backdrop,
keyboard: op.keyboard,
remote: op.remote,
show: op.show
};
var modSelector = '#' + op.id + ' .modal';
c = op.controller ? 'ng-controller=' + op.controller : '';
if (op.templateURL !== null && op.templateURL !== '') {
t = '';
} else {
var a = '';
if (op.templateHTML !== null && op.templateHTML !== '') {
t = a + op.templateHTML + '';
} else {
if (op.bodyTemplateURL !== null && op.bodyTemplateURL !== '') {
b = '';
} else {
if (op.bodyTemplate !== null && op.bodyTemplate !== '') {
b = '' + op.bodyTemplate + '';
} else {
b = 'Ekathuwa modal body.';
}
}
if (op.header) {
if (op.headerTemplate !== null && op.headerTemplate !== '') {
h = '' + op.headerTemplate + '';
} else {
var ht = '';
if (op.headerText !== null && op.headerText !== '') {
ht = '' + op.headerText + '
';
}
h = '' + ht + '';
}
}
if (op.footer) {
if (op.footerTemplate !== null && op.footerTemplate !== '') {
f = ' ';
} else {
f = '';
}
}
t = a + '