Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b4e13a2

Browse files
committed
fixup! fix($compile): use correct parent element when requiring on html element
1 parent dd00eaf commit b4e13a2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/ng/compile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2961,7 +2961,7 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
29612961
if (!value) {
29622962
var dataName = '$' + name + 'Controller';
29632963

2964-
if (inheritType === '^^' && $element[0].nodeType === NODE_TYPE_DOCUMENT) {
2964+
if (inheritType === '^^' && $element && $element[0].nodeType === NODE_TYPE_DOCUMENT) {
29652965
// inheritedData() uses the documentElement when it finds the document, so we would
29662966
// require from the element itself.
29672967
value = null;

test/e2e/tests/directive-require-html.spec.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ describe('require parent controller on html element', function() {
66
loadFixture('directive-require-html');
77

88
browser.manage().logs().get('browser').then(function(browserLogs) {
9-
expect(browserLogs[0].level.value).toBe(1000);
10-
expect(browserLogs[0].message).toContain('Controller \'requireTargetDirective\', required by directive \'requireDirective\', can\'t be found!');
9+
var requireError = browserLogs.find(function(log) {
10+
return log.level.value === 1000;
11+
});
12+
13+
expect(requireError.message).toContain('Controller \'requireTargetDirective\', required by directive \'requireDirective\', can\'t be found!');
1114
});
1215
});
1316
});

0 commit comments

Comments
 (0)