Comments (5)
I finally did it without ngAnimate service.
ModalController
myApp.controller 'ModalConfirmController', ($scope, $timeout, $element, inputs, close) ->
angular.extend $scope, inputs
$scope.id ?= 'modal-default'
$scope.backdrop ?= true
$scope.display = true
# remove class `modal-animate-enter` after modal render
# (I am still looking for a way to do it with something like `Modal.open().then`)
$timeout ->
$element.removeClass 'modal-animate-enter'
, 300
$scope.close = (result) ->
$element.addClass 'modal-animate-leave'
$timeout ->
$scope.display = false
close result
, 500
Template
.modal.modal-confirm.modal-animate-enter ng-show="display" ng-class="id"
.modal-backdrop ng-if="backdrop" ng-click="close(false)"
.modal-dialog
.modal-image ng-if="imageUrl": img ng-src="imageUrl"
.modal-title ng-if="title" ng-bind="title"
.modal-content ng-bind-html="content"
.modal-footer
button ng-click="close(false)" ng-bind="cancel.text" ng-class="cancel.class"
button ng-click="close(true)" ng-bind="confirm.text" ng-class="confirm.class"
Stylesheet
.modal
{
position: fixed;
z-index: 999;
top: 0;
right: 0;
bottom: 0;
left: 0;
height: 100%;
.modal-backdrop
{
position: absolute;
width: 100%;
height: 100%;
transition: opacity 280ms linear;
opacity: 1;
background-color: rgba(0,0,0,0.3);
}
.modal-dialog
{
position: relative;
top: 20%;
width: 650px;
max-width: 100%;
margin: 0 auto;
transition-duration: 500ms;
transition-property: transform, opacity;
transform: translateY(0);
opacity: 1;
border-radius: 10px;
background-color: $white;
box-shadow: 7px 13px 30px 0.00px rgba(75, 97, 109, 0.3);
transform-style: preserve-3d;
}
&.modal-animate-enter
{
.modal-dialog
{
transition-timing-function: cubic-bezier(0.4, 0, 0, 1.5);
transform: translateY(-200px);
}
}
&.modal-animate-leave
{
.modal-dialog
{
transition-timing-function: cubic-bezier(1.5,0,0,0.4);
transform: translateY(200px);
}
}
&.modal-animate-enter,
&.modal-animate-leave
{
.modal-dialog,
.modal-backdrop
{
opacity: 0;
}
}
}
from angular-modal-service.
Thanks for sharing your code, I'll leave this issue open for now so others can find it easily.
from angular-modal-service.
It'd be nice to have a version of this code written in standard typing, I'm assuming this is typescript or coffee script or some extended syntax I'm not familiar with.. :<
from angular-modal-service.
@LunarDevelopment yes javascript is written in coffee, css in sass and html with slim.
Here is the javascript part, compiled by js2.coffee
ModalController
myApp.controller('ModalConfirmController', function($scope, $timeout, $element, inputs, close) {
angular.extend($scope, inputs);
if ($scope.id == null) {
$scope.id = 'modal-default';
}
if ($scope.backdrop == null) {
$scope.backdrop = true;
}
$scope.display = true;
$timeout(function() {
return $element.removeClass('modal-animate-enter');
}, 300);
return $scope.close = function(result) {
$element.addClass('modal-animate-leave');
return $timeout(function() {
$scope.display = false;
return close(result);
}, 500);
};
});
from angular-modal-service.
#93 now holds context on this ongoing issue, please move conversations to that thread!
from angular-modal-service.
Related Issues (20)
- ModalService.closeModals() - Dont close other modals HOT 2
- modal dismiss HOT 4
- Memory leak HOT 2
- modal is not showing up but code js is ok
- Modal not getting closed HOT 3
- Modal service not working with bootstrap 4 beta (popper.js issue)
- Request: Upgrade to Angular 2 (and higher) HOT 2
- Browser support for angular-modal-service HOT 2
- doing operations on modal close HOT 1
- An in-range update of karma is breaking the build 🚨 HOT 15
- Close callback being called multiple times when location changes
- null is not an object (evaluating 'r.resolve')
- request: make it compatible with AngularJS 1.7 HOT 1
- Jquery datepicker not open issue in modal HOT 1
- An in-range update of webpack is breaking the build 🚨 HOT 21
- Latest version capture any angular error through the modal service
- Component bindings are bound too late HOT 3
- Can't overlay modals HOT 1
- An in-range update of uglify-js is breaking the build 🚨 HOT 22
- Close in a single controller?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-modal-service.