Skip to content

Commit 5cea616

Browse files
committed
support for injection properties when controller is defined with controller as property syntax
1 parent f0c4baa commit 5cea616

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ui-scroll.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ angular.module('ui.scroll', [])
506506
let scope = viewportScope;
507507
let assign;
508508
if (expression) {
509-
let match = expression.match(/^(\S+)(?:\s+on\s+(\w(?:\w|\d)*))?$/);
509+
let match = expression.match(/(\w(?:\w|\d)*)(?:\s+on\s+(\w(?:\w|\d)*))?/);
510510
if (!match)
511511
throw new Error('Expected injection expression in form of \'target\' or \'target on controller\' but got \'' + expression + '\'');
512512
let target = match[1];
@@ -515,8 +515,8 @@ angular.module('ui.scroll', [])
515515
let candidate = viewport;
516516
scope = undefined;
517517
while (candidate.length) {
518-
let controller = candidate.attr('ng-controller');
519-
if (controller === controllerName) {
518+
let candidateName = (candidate.attr('ng-controller') || '').match(/(\w(?:\w|\d)*)(?:\s+as\s+(\w(?:\w|\d)*))?/);
519+
if (candidateName && candidateName[1] === controllerName) {
520520
scope = candidate.scope();
521521
break;
522522
}

0 commit comments

Comments
 (0)