You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
I'm using 1.1.5 unstable branch.
When I click the link it doesn't fire off the $http request.
When I click a $http request element directly after both fire at same time.
directives.directive('ngPopup', function(Popup){
return {
restrict: 'A',
link: function postLink(scope, element, attrs) {
var ngPopupUrl = attrs['ngPopup'];
// Could have custom or boostrap modal options here
var popupOptions = {};
element.bind( "click", function(){
Popup.load(ngPopupUrl, scope, popupOptions);
});
}
};
});
services.factory('Popup', function ($http, $compile) {
// Got the idea for this from a post I found. Tried to not have to make this
// object but couldn't think of a way to get around this
var popupService = {};
// Loads the popup
popupService.load = function(url, scope, options) {
$http.get(url).success(function (data) {
l(1);
var popup = popupService.getPopup(true);
popup.html(data);
popupService.compileAndRunPopup(popup, scope, options);
popup.find(".btn-cancel").click(function () {
popupService.close();
});
});
}
});
@clouddueling This is a side-effect of promise-based request interceptors introduced in 1.1.4. Now request interceptors are promise-based and AngularJS promises are only resolved within $digest cycle. As from 1.1.4 you need to trigger $http / $resource requests from AngularJS $digest loop.
In your particular case you need to wrap a call to the Popup.load(ngPopupUrl, scope, popupOptions); into $scope.$apply since you are triggering this call outside of the "AngularJS world".
I'm using 1.1.5 unstable branch.
When I click the link it doesn't fire off the $http request.
When I click a $http request element directly after both fire at same time.
Example: http://plnkr.co/edit/wpA2Oa0y1pKSWv8kR3AP?p=preview
https://github.com/clouddueling/angularjs-modals
The text was updated successfully, but these errors were encountered: