@@ -65,11 +65,15 @@ function lifeCycle($stateParams, $timeout, $ionicHistory) {
6565
6666 link : link ,
6767 restrict : 'A' ,
68- scope : false
68+ scope : false ,
69+ controller : Controller
70+ // scope: {}
71+
6972 } ;
7073 return directive ;
7174
72- function link ( scope , element , attrs ) {
75+ function link ( scope , element , attrs , ctrl ) {
76+ console . info ( 'directiveController' , ctrl )
7377 var idx = 0 ;
7478 console . time ( 'loaded' )
7579 console . time ( 'beforeEnter' )
@@ -89,6 +93,7 @@ function lifeCycle($stateParams, $timeout, $ionicHistory) {
8993 scope . $on ( '$ionicView.beforeEnter' , function ( ) {
9094 // Anything you can think of
9195 console . log ( _nameView + ' BeforeEnter' , scope , scope . $id )
96+ console . info ( 'directiveController' , ctrl )
9297 console . log ( '$ionicHistory currentState ' + $ionicHistory . currentStateName ( ) )
9398
9499 console . timeEnd ( 'beforeEnter' )
@@ -102,13 +107,15 @@ function lifeCycle($stateParams, $timeout, $ionicHistory) {
102107 } ) ;
103108 scope . $on ( '$ionicView.enter' , function ( ) {
104109 console . log ( _nameView + ' enter' , scope , scope . $id )
110+ console . info ( 'directiveController' , ctrl )
105111 console . log ( '$ionicHistory currentState ' + $ionicHistory . currentStateName ( ) )
106112
107113 console . timeEnd ( 'enter' )
108114 // Anything you can think of
109115 } ) ;
110116 scope . $on ( '$ionicView.afterEnter' , function ( ) {
111117 console . log ( _nameView + ' afterEnter' , scope , scope . $id )
118+ console . info ( 'directiveController' , ctrl )
112119 console . log ( '$ionicHistory currentState ' + $ionicHistory . currentStateName ( ) )
113120
114121 console . timeEnd ( 'afterEnter' ) ;
@@ -146,4 +153,9 @@ function lifeCycle($stateParams, $timeout, $ionicHistory) {
146153 // Anything you can think of
147154 } ) ;
148155 }
156+
157+ function Controller ( ) {
158+ vm = this ;
159+ vm . test = '0elo'
160+ }
149161}
0 commit comments