Skip to content

Commit 63df6c7

Browse files
committed
Merge pull request #70 from lmessinger/inject-element
Allow element and attr injections
2 parents 6068faa + ac4e8a3 commit 63df6c7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/viewDirective.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ function $ViewDirective( $state, $compile, $controller, $anchorScroll) {
4040
viewScope = scope.$new();
4141
if (locals.$$controller) {
4242
locals.$scope = viewScope;
43+
// This is a 'directive controller'. need to allow element and attr injections (TBD: transcludeFn)
44+
locals.$element = element;
45+
locals.$attrs = attr;
46+
//store directive controller with distinct name on the element.data as per angular.js convention
4347
var controller = $controller(locals.$$controller, locals);
44-
element.contents().data('$ngControllerController', controller);
48+
element.data('$' + name+'Controller', controller);
4549
}
4650
link(viewScope);
4751
viewScope.$emit('$viewContentLoaded');

0 commit comments

Comments
 (0)