Skip to content

Commit

Permalink
Merge pull request angular-ui#70 from lmessinger/inject-element
Browse files Browse the repository at this point in the history
Allow element and attr injections
  • Loading branch information
nfx committed Apr 3, 2013
2 parents 6068faa + ac4e8a3 commit 63df6c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/viewDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ function $ViewDirective( $state, $compile, $controller, $anchorScroll) {
viewScope = scope.$new();
if (locals.$$controller) {
locals.$scope = viewScope;
// This is a 'directive controller'. need to allow element and attr injections (TBD: transcludeFn)
locals.$element = element;
locals.$attrs = attr;
//store directive controller with distinct name on the element.data as per angular.js convention
var controller = $controller(locals.$$controller, locals);
element.contents().data('$ngControllerController', controller);
element.data('$' + name+'Controller', controller);
}
link(viewScope);
viewScope.$emit('$viewContentLoaded');
Expand Down

0 comments on commit 63df6c7

Please sign in to comment.