@@ -554,8 +554,8 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
554
554
backdrop : true , //can also be false or 'static'
555
555
keyboard : true
556
556
} ,
557
- $get : [ '$injector' , '$rootScope' , '$q' , '$templateRequest' , '$controller' , '$uibModalStack' , '$modalSuppressWarning' , '$log' ,
558
- function ( $injector , $rootScope , $q , $templateRequest , $controller , $modalStack , $modalSuppressWarning , $log ) {
557
+ $get : [ '$injector' , '$rootScope' , '$q' , '$templateRequest' , '$controller' , '$uibModalStack' ,
558
+ function ( $injector , $rootScope , $q , $templateRequest , $controller , $modalStack ) {
559
559
var $modal = { } ;
560
560
561
561
function getTemplatePromise ( options ) {
@@ -642,15 +642,6 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
642
642
if ( modalOptions . controller ) {
643
643
ctrlLocals . $scope = modalScope ;
644
644
ctrlLocals . $uibModalInstance = modalInstance ;
645
- Object . defineProperty ( ctrlLocals , '$modalInstance' , {
646
- get : function ( ) {
647
- if ( ! $modalSuppressWarning ) {
648
- $log . warn ( '$modalInstance is now deprecated. Use $uibModalInstance instead.' ) ;
649
- }
650
-
651
- return modalInstance ;
652
- }
653
- } ) ;
654
645
angular . forEach ( modalOptions . resolve , function ( value , key ) {
655
646
ctrlLocals [ key ] = tplAndVars [ resolveIter ++ ] ;
656
647
} ) ;
@@ -702,232 +693,3 @@ angular.module('ui.bootstrap.modal', ['ui.bootstrap.stackedMap'])
702
693
703
694
return $modalProvider ;
704
695
} ) ;
705
-
706
- /* deprecated modal below */
707
-
708
- angular . module ( 'ui.bootstrap.modal' )
709
-
710
- . value ( '$modalSuppressWarning' , false )
711
-
712
- /**
713
- * A helper directive for the $modal service. It creates a backdrop element.
714
- */
715
- . directive ( 'modalBackdrop' , [
716
- '$animate' , '$injector' , '$modalStack' , '$log' , '$modalSuppressWarning' ,
717
- function ( $animate , $injector , $modalStack , $log , $modalSuppressWarning ) {
718
- var $animateCss = null ;
719
-
720
- if ( $injector . has ( '$animateCss' ) ) {
721
- $animateCss = $injector . get ( '$animateCss' ) ;
722
- }
723
-
724
- return {
725
- replace : true ,
726
- templateUrl : 'template/modal/backdrop.html' ,
727
- compile : function ( tElement , tAttrs ) {
728
- tElement . addClass ( tAttrs . backdropClass ) ;
729
- return linkFn ;
730
- }
731
- } ;
732
-
733
- function linkFn ( scope , element , attrs ) {
734
- if ( ! $modalSuppressWarning ) {
735
- $log . warn ( 'modal-backdrop is now deprecated. Use uib-modal-backdrop instead.' ) ;
736
- }
737
- element . addClass ( 'modal-backdrop' ) ;
738
-
739
- if ( attrs . modalInClass ) {
740
- if ( $animateCss ) {
741
- $animateCss ( element , {
742
- addClass : attrs . modalInClass
743
- } ) . start ( ) ;
744
- } else {
745
- $animate . addClass ( element , attrs . modalInClass ) ;
746
- }
747
-
748
- scope . $on ( $modalStack . NOW_CLOSING_EVENT , function ( e , setIsAsync ) {
749
- var done = setIsAsync ( ) ;
750
- if ( $animateCss ) {
751
- $animateCss ( element , {
752
- removeClass : attrs . modalInClass
753
- } ) . start ( ) . then ( done ) ;
754
- } else {
755
- $animate . removeClass ( element , attrs . modalInClass ) . then ( done ) ;
756
- }
757
- } ) ;
758
- }
759
- }
760
- } ] )
761
-
762
- . directive ( 'modalWindow' , [
763
- '$modalStack' , '$q' , '$animate' , '$injector' , '$log' , '$modalSuppressWarning' ,
764
- function ( $modalStack , $q , $animate , $injector , $log , $modalSuppressWarning ) {
765
- var $animateCss = null ;
766
-
767
- if ( $injector . has ( '$animateCss' ) ) {
768
- $animateCss = $injector . get ( '$animateCss' ) ;
769
- }
770
-
771
- return {
772
- scope : {
773
- index : '@'
774
- } ,
775
- replace : true ,
776
- transclude : true ,
777
- templateUrl : function ( tElement , tAttrs ) {
778
- return tAttrs . templateUrl || 'template/modal/window.html' ;
779
- } ,
780
- link : function ( scope , element , attrs ) {
781
- if ( ! $modalSuppressWarning ) {
782
- $log . warn ( 'modal-window is now deprecated. Use uib-modal-window instead.' ) ;
783
- }
784
- element . addClass ( attrs . windowClass || '' ) ;
785
- element . addClass ( attrs . windowTopClass || '' ) ;
786
- scope . size = attrs . size ;
787
-
788
- scope . close = function ( evt ) {
789
- var modal = $modalStack . getTop ( ) ;
790
- if ( modal && modal . value . backdrop && modal . value . backdrop !== 'static' && ( evt . target === evt . currentTarget ) ) {
791
- evt . preventDefault ( ) ;
792
- evt . stopPropagation ( ) ;
793
- $modalStack . dismiss ( modal . key , 'backdrop click' ) ;
794
- }
795
- } ;
796
-
797
- // moved from template to fix issue #2280
798
- element . on ( 'click' , scope . close ) ;
799
-
800
- // This property is only added to the scope for the purpose of detecting when this directive is rendered.
801
- // We can detect that by using this property in the template associated with this directive and then use
802
- // {@link Attribute#$observe } on it. For more details please see {@link TableColumnResize }.
803
- scope . $isRendered = true ;
804
-
805
- // Deferred object that will be resolved when this modal is render.
806
- var modalRenderDeferObj = $q . defer ( ) ;
807
- // Observe function will be called on next digest cycle after compilation, ensuring that the DOM is ready.
808
- // In order to use this way of finding whether DOM is ready, we need to observe a scope property used in modal's template.
809
- attrs . $observe ( 'modalRender' , function ( value ) {
810
- if ( value == 'true' ) {
811
- modalRenderDeferObj . resolve ( ) ;
812
- }
813
- } ) ;
814
-
815
- modalRenderDeferObj . promise . then ( function ( ) {
816
- var animationPromise = null ;
817
-
818
- if ( attrs . modalInClass ) {
819
- if ( $animateCss ) {
820
- animationPromise = $animateCss ( element , {
821
- addClass : attrs . modalInClass
822
- } ) . start ( ) ;
823
- } else {
824
- animationPromise = $animate . addClass ( element , attrs . modalInClass ) ;
825
- }
826
-
827
- scope . $on ( $modalStack . NOW_CLOSING_EVENT , function ( e , setIsAsync ) {
828
- var done = setIsAsync ( ) ;
829
- if ( $animateCss ) {
830
- $animateCss ( element , {
831
- removeClass : attrs . modalInClass
832
- } ) . start ( ) . then ( done ) ;
833
- } else {
834
- $animate . removeClass ( element , attrs . modalInClass ) . then ( done ) ;
835
- }
836
- } ) ;
837
- }
838
-
839
-
840
- $q . when ( animationPromise ) . then ( function ( ) {
841
- var inputWithAutofocus = element [ 0 ] . querySelector ( '[autofocus]' ) ;
842
- /**
843
- * Auto-focusing of a freshly-opened modal element causes any child elements
844
- * with the autofocus attribute to lose focus. This is an issue on touch
845
- * based devices which will show and then hide the onscreen keyboard.
846
- * Attempts to refocus the autofocus element via JavaScript will not reopen
847
- * the onscreen keyboard. Fixed by updated the focusing logic to only autofocus
848
- * the modal element if the modal does not contain an autofocus element.
849
- */
850
- if ( inputWithAutofocus ) {
851
- inputWithAutofocus . focus ( ) ;
852
- } else {
853
- element [ 0 ] . focus ( ) ;
854
- }
855
- } ) ;
856
-
857
- // Notify {@link $modalStack } that modal is rendered.
858
- var modal = $modalStack . getTop ( ) ;
859
- if ( modal ) {
860
- $modalStack . modalRendered ( modal . key ) ;
861
- }
862
- } ) ;
863
- }
864
- } ;
865
- } ] )
866
-
867
- . directive ( 'modalAnimationClass' , [
868
- '$log' , '$modalSuppressWarning' ,
869
- function ( $log , $modalSuppressWarning ) {
870
- return {
871
- compile : function ( tElement , tAttrs ) {
872
- if ( ! $modalSuppressWarning ) {
873
- $log . warn ( 'modal-animation-class is now deprecated. Use uib-modal-animation-class instead.' ) ;
874
- }
875
- if ( tAttrs . modalAnimation ) {
876
- tElement . addClass ( tAttrs . modalAnimationClass ) ;
877
- }
878
- }
879
- } ;
880
- } ] )
881
-
882
- . directive ( 'modalTransclude' , [
883
- '$log' , '$modalSuppressWarning' ,
884
- function ( $log , $modalSuppressWarning ) {
885
- return {
886
- link : function ( $scope , $element , $attrs , controller , $transclude ) {
887
- if ( ! $modalSuppressWarning ) {
888
- $log . warn ( 'modal-transclude is now deprecated. Use uib-modal-transclude instead.' ) ;
889
- }
890
- $transclude ( $scope . $parent , function ( clone ) {
891
- $element . empty ( ) ;
892
- $element . append ( clone ) ;
893
- } ) ;
894
- }
895
- } ;
896
- } ] )
897
-
898
- . service ( '$modalStack' , [
899
- '$animate' , '$timeout' , '$document' , '$compile' , '$rootScope' ,
900
- '$q' ,
901
- '$injector' ,
902
- '$$multiMap' ,
903
- '$$stackedMap' ,
904
- '$uibModalStack' ,
905
- '$log' ,
906
- '$modalSuppressWarning' ,
907
- function ( $animate , $timeout , $document , $compile , $rootScope ,
908
- $q ,
909
- $injector ,
910
- $$multiMap ,
911
- $$stackedMap ,
912
- $uibModalStack ,
913
- $log ,
914
- $modalSuppressWarning ) {
915
- if ( ! $modalSuppressWarning ) {
916
- $log . warn ( '$modalStack is now deprecated. Use $uibModalStack instead.' ) ;
917
- }
918
-
919
- angular . extend ( this , $uibModalStack ) ;
920
- } ] )
921
-
922
- . provider ( '$modal' , [ '$uibModalProvider' , function ( $uibModalProvider ) {
923
- angular . extend ( this , $uibModalProvider ) ;
924
-
925
- this . $get = [ '$injector' , '$log' , '$modalSuppressWarning' ,
926
- function ( $injector , $log , $modalSuppressWarning ) {
927
- if ( ! $modalSuppressWarning ) {
928
- $log . warn ( '$modal is now deprecated. Use $uibModal instead.' ) ;
929
- }
930
-
931
- return $injector . invoke ( $uibModalProvider . $get ) ;
932
- } ] ;
933
- } ] ) ;
0 commit comments