File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ angular . module ( 'angularBootstrapMaterial' )
2+ . directive ( 'abmComponent' , [ 'ripple' , function ( ripple ) {
3+ return {
4+ link : function ( $scope , $element , attrs ) {
5+ var componentMap = {
6+ ".btn:not(.btn-link)" : "" ,
7+ ".card-image" : "" ,
8+ ".navbar" : "a:not(.withoutripple)" ,
9+ ".dropdown-menu" : "a" ,
10+ ".nav-tabs" : "a:not(.withoutripple)" ,
11+ ".withripple" : "" ,
12+ ".pagination" : "li:not(.active):not(.disabled) a:not(.withoutripple)"
13+ } ;
14+ var matches = null ;
15+ //check if the element
16+ $parent = $element . parent ( ) ;
17+ for ( var key in componentMap ) {
18+ if ( componentMap . hasOwnProperty ( key ) ) {
19+ var value = componentMap [ key ] ;
20+ if ( matches ) break ;
21+ var elems = $parent [ 0 ] . querySelectorAll ( key ) ;
22+ for ( var i = 0 ; i < elems . length ; i ++ ) {
23+ var elem = elems [ i ] ;
24+ if ( elem === $element [ 0 ] ) {
25+ if ( value )
26+ matches = elem . querySelectorAll ( value ) ;
27+ else
28+ matches = elem ;
29+ break ;
30+ }
31+ }
32+ }
33+ }
34+ angular . forEach ( matches , function ( elem ) {
35+ ripple ( angular . element ( elem ) ) ;
36+ } ) ;
37+ }
38+ } ;
39+ } ] ) ;
You can’t perform that action at this time.
0 commit comments