angular-modal-service
Advanced tools
Comparing version 0.6.4 to 0.6.5
{ | ||
"name": "angular-modal-service", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"homepage": "https://github.com/dwmkerr/angular-modal-service", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -0,1 +1,6 @@ | ||
## v0.6.5 | ||
* Reverted changes below as they led to a bug with injected `$element` in modal controller. | ||
Added a test to protect against this case in the future. | ||
## v0.6.4 | ||
@@ -2,0 +7,0 @@ |
@@ -77,3 +77,3 @@ // angularModalService.js | ||
// Create a new scope for the modal. | ||
var modalScope = options.scope || $rootScope.$new(); | ||
var modalScope = $rootScope.$new(); | ||
@@ -80,0 +80,0 @@ // Create the inputs object to the controller - this will include |
/*angular-modal-service v0.6.4 - https://github.com/dwmkerr/angular-modal-service */ | ||
!function(){"use strict";var e=angular.module("angularModalService",[]);e.factory("ModalService",["$document","$compile","$controller","$http","$rootScope","$q","$templateCache",function(e,n,t,o,l,r,c){function a(){var e=this,a=function(e,n){var t=r.defer();if(e)t.resolve(e);else if(n){var l=c.get(n);void 0!==l?t.resolve(l):o({method:"GET",url:n,cache:!0}).then(function(e){c.put(n,e.data),t.resolve(e.data)})["catch"](function(e){t.reject(e)})}else t.reject("No template or templateUrl has been specified.");return t.promise};e.showModal=function(e){var o=r.defer(),c=e.controller;return c?(e.controllerAs&&(c=c+" as "+e.controllerAs),a(e.template,e.templateUrl).then(function(a){var u=e.scope||l.$new(),s=r.defer(),p={$scope:u,close:function(e,n){(void 0===n||null===n)&&(n=0),window.setTimeout(function(){s.resolve(e),u.$destroy(),h.remove(),p.close=null,o=null,s=null,$=null,p=null,h=null,u=null},n)}};if(e.inputs)for(var d in e.inputs)p[d]=e.inputs[d];var f=angular.element(a),m=t(c,p),v=n(f),h=v(u);p.$element=h,e.appendElement?e.appendElement.append(h):i.append(h);var $={controller:m,scope:u,element:h,close:s.promise};o.resolve($)})["catch"](function(e){o.reject(e)}),o.promise):(o.reject("No controller has been specified."),o.promise)}}var i=e.find("body");return new a}])}(); | ||
!function(){"use strict";var e=angular.module("angularModalService",[]);e.factory("ModalService",["$document","$compile","$controller","$http","$rootScope","$q","$templateCache",function(e,n,t,o,l,r,c){function a(){var e=this,a=function(e,n){var t=r.defer();if(e)t.resolve(e);else if(n){var l=c.get(n);void 0!==l?t.resolve(l):o({method:"GET",url:n,cache:!0}).then(function(e){c.put(n,e.data),t.resolve(e.data)})["catch"](function(e){t.reject(e)})}else t.reject("No template or templateUrl has been specified.");return t.promise};e.showModal=function(e){var o=r.defer(),c=e.controller;return c?(e.controllerAs&&(c=c+" as "+e.controllerAs),a(e.template,e.templateUrl).then(function(a){var u=l.$new(),s=r.defer(),p={$scope:u,close:function(e,n){(void 0===n||null===n)&&(n=0),window.setTimeout(function(){s.resolve(e),u.$destroy(),h.remove(),p.close=null,o=null,s=null,$=null,p=null,h=null,u=null},n)}};if(e.inputs)for(var d in e.inputs)p[d]=e.inputs[d];var f=angular.element(a),m=t(c,p),v=n(f),h=v(u);p.$element=h,e.appendElement?e.appendElement.append(h):i.append(h);var $={controller:m,scope:u,element:h,close:s.promise};o.resolve($)})["catch"](function(e){o.reject(e)}),o.promise):(o.reject("No controller has been specified."),o.promise)}}var i=e.find("body");return new a}])}(); | ||
//# sourceMappingURL=angular-modal-service.min.js.map |
@@ -0,0 +0,0 @@ var gulp = require('gulp'); |
{ | ||
"name": "angular-modal-service", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"description": "AngularJS Service for showing Modals and Popups", | ||
@@ -5,0 +5,0 @@ "main": "./dst/angular-modal-service.js", |
@@ -125,3 +125,2 @@ angular-modal-service | ||
* `appendElement`: The custom angular element to append the modal to instead of default `body` element. | ||
* `scope`: Optional. If provided, a new scope will not be created for the model - this scope will be used. Be aware that the modal service will *still* destroy the scope when the modal is closed. Typically you should not need to use this field, as the generated scope will handle most use cases. | ||
@@ -128,0 +127,0 @@ #### The Modal Object |
@@ -0,0 +0,0 @@ var app = angular.module('sampleapp'); |
@@ -0,0 +0,0 @@ var app = angular.module('sampleapp'); |
@@ -0,0 +0,0 @@ // Build our app module, with a dependency on the angular modal service. |
@@ -0,0 +0,0 @@ var app = angular.module('sampleapp'); |
@@ -77,3 +77,3 @@ // angularModalService.js | ||
// Create a new scope for the modal. | ||
var modalScope = options.scope || $rootScope.$new(); | ||
var modalScope = $rootScope.$new(); | ||
@@ -123,5 +123,2 @@ // Create the inputs object to the controller - this will include | ||
// Create the controller, explicitly specifying the scope to use. | ||
var modalController = $controller(controllerName, inputs); | ||
// Compile then link the template element, building the actual element. | ||
@@ -133,2 +130,4 @@ // Set the $element on the inputs so that it can be injected if required. | ||
// Create the controller, explicitly specifying the scope to use. | ||
var modalController = $controller(controllerName, inputs); | ||
@@ -135,0 +134,0 @@ // Finally, append the modal to the dom. |
@@ -0,0 +0,0 @@ describe('basics', function() { |
@@ -18,2 +18,5 @@ describe('controller', function() { | ||
this.character = "Fry"; | ||
}) | ||
.controller('ElementController', function($scope, $element) { | ||
$scope.getElement = function() { return $element; }; | ||
}); | ||
@@ -101,2 +104,20 @@ | ||
it('should inject the modal element into the controller', function() { | ||
$httpBackend.expectGET('some/controllertemplate.html'); | ||
ModalService.showModal({ | ||
controller: 'ElementController', | ||
templateUrl: 'some/controllertemplate.html' | ||
}).then(function(modal) { | ||
// The controller should be on the scope. | ||
expect(modal.scope.getElement()).not.toBeUndefined(); | ||
}); | ||
$httpBackend.flush(); | ||
}); | ||
}); |
@@ -0,0 +0,0 @@ describe('dom', function() { |
@@ -0,0 +0,0 @@ module.exports = function(config) { |
@@ -0,0 +0,0 @@ describe('parameters', function() { |
@@ -0,0 +0,0 @@ describe('template', function() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
6
2517931
41489
248