Skip to content

Commit 991ad63

Browse files
committed
Bumped version number
1 parent d9ecf66 commit 991ad63

File tree

3 files changed

+59
-70
lines changed

3 files changed

+59
-70
lines changed

angular-ui-router-uib-modal.js

Lines changed: 57 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,72 @@
33
*
44
* @link https://github.com/nonplus/angular-ui-router-uib-modal
55
*
6-
* @license angular-ui-router-uib-modal v0.0.10
6+
* @license angular-ui-router-uib-modal v0.0.11
77
* (c) Copyright Stepan Riha <[email protected]>
88
* License MIT
99
*/
1010

1111
(function(angular) {
1212

13-
/* global angular */
1413
"use strict";
1514
angular.module("ui.router.modal", ["ui.router"])
16-
.config(["$stateProvider", function($stateProvider) {
17-
18-
var stateProviderState = $stateProvider.state;
19-
20-
$stateProvider.state = function(stateName, options) {
21-
22-
// check for $stateProvider.state({name: "state", ...}) usage
23-
if (angular.isObject(stateName)) {
24-
options = stateName;
25-
stateName = options.name;
26-
}
27-
28-
if (options.modal) {
29-
30-
if (options.onEnter) {
31-
throw new Error("Invalid modal state definition: The onEnter setting may not be specified.");
32-
}
33-
34-
if (options.onExit) {
35-
throw new Error("Invalid modal state definition: The onExit setting may not be specified.");
36-
}
37-
38-
var openModal;
39-
40-
// Get modal.resolve keys from state.modal or state.resolve
41-
var resolve = (Array.isArray(options.modal) ? options.modal : []).concat(Object.keys(options.resolve || {}));
42-
43-
var inject = ["$uibModal", "$state"];
44-
options.onEnter = function($uibModal, $state) {
45-
46-
// Add resolved values to modal options
47-
if (resolve.length) {
48-
options.resolve = {};
49-
for(var i = 0; i < resolve.length; i++) {
50-
options.resolve[resolve[i]] = injectedConstant(arguments[inject.length + i]);
51-
}
52-
}
53-
54-
var thisModal = openModal = $uibModal.open(options);
55-
56-
openModal.result['finally'](function() {
57-
if (thisModal === openModal) {
58-
// Dialog was closed via $uibModalInstance.close/dismiss, go to our parent state
59-
$state.go($state.get("^", stateName).name);
60-
}
61-
});
62-
};
63-
64-
// Make sure that onEnter receives state.resolve configuration
65-
options.onEnter.$inject = inject.concat(resolve);
66-
67-
options.onExit = function() {
68-
if (openModal) {
69-
// State has changed while dialog was open
70-
openModal.close();
71-
openModal = null;
72-
}
73-
};
74-
75-
}
76-
77-
return stateProviderState.call($stateProvider, stateName, options);
78-
};
79-
}]);
80-
15+
.config(["$stateProvider", function ($stateProvider) {
16+
var stateProviderState = $stateProvider.state;
17+
$stateProvider["state"] = state;
18+
function state(name, config) {
19+
var stateName;
20+
var options;
21+
// check for $stateProvider.state({name: "state", ...}) usage
22+
if (angular.isObject(name)) {
23+
options = name;
24+
stateName = options.name;
25+
}
26+
else {
27+
options = config;
28+
stateName = name;
29+
}
30+
if (options.modal) {
31+
if (options.onEnter) {
32+
throw new Error("Invalid modal state definition: The onEnter setting may not be specified.");
33+
}
34+
if (options.onExit) {
35+
throw new Error("Invalid modal state definition: The onExit setting may not be specified.");
36+
}
37+
var openModal_1;
38+
// Get modal.resolve keys from state.modal or state.resolve
39+
var resolve_1 = (Array.isArray(options.modal) ? options.modal : []).concat(Object.keys(options.resolve || {}));
40+
var inject_1 = ["$uibModal", "$state"];
41+
options.onEnter = function ($uibModal, $state) {
42+
// Add resolved values to modal options
43+
if (resolve_1.length) {
44+
options.resolve = {};
45+
for (var i = 0; i < resolve_1.length; i++) {
46+
options.resolve[resolve_1[i]] = injectedConstant(arguments[inject_1.length + i]);
47+
}
48+
}
49+
var thisModal = openModal_1 = $uibModal.open(options);
50+
openModal_1.result['finally'](function () {
51+
if (thisModal === openModal_1) {
52+
// Dialog was closed via $uibModalInstance.close/dismiss, go to our parent state
53+
$state.go($state.get("^", stateName).name);
54+
}
55+
});
56+
};
57+
// Make sure that onEnter receives state.resolve configuration
58+
options.onEnter["$inject"] = inject_1.concat(resolve_1);
59+
options.onExit = function () {
60+
if (openModal_1) {
61+
// State has changed while dialog was open
62+
openModal_1.close();
63+
openModal_1 = null;
64+
}
65+
};
66+
}
67+
return stateProviderState.call($stateProvider, stateName, options);
68+
}
69+
}]);
8170
function injectedConstant(val) {
82-
return [function() { return val; }];
71+
return [function () { return val; }];
8372
}
8473

8574

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-router-uib-modal",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"homepage": "https://github.com/nonplus/angular-ui-router-uib-modal",
55
"authors": [
66
"Stepan Riha <[email protected]>"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-ui-router-uib-modal",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "AngularJS module that adds support for ui-bootstrap modal states when using ui-router.",
55
"main": "angular-ui-router-uib-modal.js",
66
"types": "./index.d.ts",

0 commit comments

Comments
 (0)