Skip to content

Commit

Permalink
fix: don't compile text nodes in the directive
Browse files Browse the repository at this point in the history
Fixes #168
  • Loading branch information
ocombe committed May 29, 2015
1 parent 6733616 commit 8900e49
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 11 deletions.
9 changes: 8 additions & 1 deletion dist/modules/ocLazyLoad.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@
}, function (moduleName) {
if (angular.isDefined(moduleName)) {
$ocLazyLoad.load(moduleName).then(function () {
$animate.enter($compile(content)($scope), $element);
$animate.enter(content, $element);
var contents = element.contents();
angular.forEach(contents, function (content) {
if (content.nodeType !== 3) {
// 3 is a text node
$compile(content)($scope);
}
});
});
}
}, true);
Expand Down
9 changes: 8 additions & 1 deletion dist/ocLazyLoad.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.min.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion dist/ocLazyLoad.require.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.require.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.require.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ocLazyLoad.require.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/complexExample/partials/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h3>Autoload a complete module with dependencies and templates using the directi

<!-- gridModule has been defined in the app config -->
<div oc-lazy-load="gridModule">
<div ng-controller="GridModuleCtrl">
<div ng-controller="GridModuleCtrl">
<span>{{test}}</span><br/>
<div ui-grid="gridOptions" class="gridStyle"></div>
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/ocLazyLoad.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@
}, moduleName => {
if(angular.isDefined(moduleName)) {
$ocLazyLoad.load(moduleName).then(() => {
$animate.enter($compile(content)($scope), $element);
$animate.enter(content, $element);
let contents = element.contents();
angular.forEach(contents, content => {
if(content.nodeType !== 3) { // 3 is a text node
$compile(content)($scope);
}
});
});
}
}, true);
Expand Down

0 comments on commit 8900e49

Please sign in to comment.