Skip to content

Commit 45a6481

Browse files
authored
Merge pull request #2 from jlemaes/master
always instantiate controller
2 parents cb585da + 979c8cf commit 45a6481

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Sander Keymeulen <[email protected]>"
55
],
66
"description": "An AngularJS wrapper for Sweet Alert 2",
7-
"version": "1.3.2",
7+
"version": "1.3.3",
88
"main": "swangular.js",
99
"moduleType": [],
1010
"keywords": [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swangular",
3-
"version": "1.3.2",
3+
"version": "1.3.3",
44
"description": "An AngularJS wrapper for Sweet Alert 2",
55
"main": "swangular.js",
66
"scripts": {

swangular.js

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ angular.module('swangular', [])
120120
locals,
121121
{
122122
$scope: scope
123-
}), true, controllerAs);
123+
}), false, controllerAs);
124124

125-
if(typeof preConfirm === 'string'){
126-
options.preConfirm = controllerInstance()[preConfirm];
127-
}
125+
if (typeof preConfirm === 'string'){
126+
options.preConfirm = controllerInstance[preConfirm];
127+
} else if (typeof preConfirm === 'function'){
128+
options.preConfirm = preConfirm;
129+
}
128130
}
129131
var prom = swal(options);
130132
var html = document.getElementsByClassName('swal2-modal')[0];
@@ -137,20 +139,6 @@ angular.module('swangular', [])
137139

138140
}
139141

140-
function _wrapHtmlInController(options, html){
141-
142-
var controllerString = 'ng-controller="' + options.controller;
143-
144-
if(options.controllerAs){
145-
146-
controllerString = controllerString.concat(' as ' + options.controllerAs);
147-
148-
}
149-
150-
return '<div ' + controllerString + '">' + html + '</div>';
151-
152-
}
153-
154142
function _getHtml(options){
155143

156144
if(options.htmlTemplate) {

0 commit comments

Comments
 (0)