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
+ <!DOCTYPE html>
2
+ < html >
3
+ < head >
4
+ < title > directives</ title >
5
+ < style >
6
+ * {font-family : Tahoma; font-size : 1em ;}# wrapper {width : 100% ;};
7
+ # inner {width : 50% ; margin : 0 auto; border : solid black 1px ;};
8
+ </ style >
9
+
10
+ < script src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.17/angular.min.js "> </ script >
11
+
12
+ < script >
13
+ var app = angular . module ( "usefulDirectives" , [ ] ) ;
14
+
15
+ app . directive ( "enter" , function ( ) {
16
+ //by default this is of restrict:'A'
17
+ return function ( scope , element ) {
18
+ element . bind ( "mouseenter" , function ( ) {
19
+ console . log ( "Entered!" ) ;
20
+ } ) ;
21
+ } ;
22
+ } ) ;
23
+
24
+ app . directive ( "leave" , function ( ) {
25
+ //by default this is of restrict:'A'
26
+ return function ( scope , element ) {
27
+ element . bind ( "mouseleave" , function ( ) {
28
+ console . log ( "Left!" ) ;
29
+ } ) ;
30
+ } ;
31
+ } ) ;
32
+
33
+ </ script >
34
+
35
+ </ head >
36
+ < body ng-app ="usefulDirectives ">
37
+ < div enter leave > Content</ div >
38
+ </ body >
39
+ </ html >
You can’t perform that action at this time.
0 commit comments