Skip to content

Commit b47adfd

Browse files
committed
Merge pull request johnpapa#216 from fta1/master
fix Y075/controllerAs example to account for the isolated scope. I'll merge but have a few changes to make after this
2 parents c132190 + 657607c commit b47adfd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,13 +1206,13 @@ While this guide explains the *what*, *why* and *how*, I find it helpful to see
12061206
},
12071207
link: linkFunc,
12081208
controller: ExampleController,
1209-
controllerAs: 'vm'
1209+
controllerAs: 'vm',
1210+
bindToController: true // because the scope is isolated
12101211
};
1211-
1212+
12121213
return directive;
12131214

12141215
function linkFunc(scope, el, attr, ctrl) {
1215-
console.log('LINK: scope.max = %i', scope.max);
12161216
console.log('LINK: scope.vm.min = %i', scope.vm.min);
12171217
console.log('LINK: scope.vm.max = %i', scope.vm.max);
12181218
}
@@ -1224,9 +1224,8 @@ While this guide explains the *what*, *why* and *how*, I find it helpful to see
12241224
// Injecting $scope just for comparison
12251225
var vm = this;
12261226

1227-
vm.min = 3;
1228-
vm.max = $scope.max;
1229-
console.log('CTRL: $scope.max = %i', $scope.max);
1227+
vm.min = 3;
1228+
console.log('CTRL: $scope.vm.max = %i', $scope.vm.max);
12301229
console.log('CTRL: vm.min = %i', vm.min);
12311230
console.log('CTRL: vm.max = %i', vm.max);
12321231
}

0 commit comments

Comments
 (0)