diff --git a/src/loading-bar.js b/src/loading-bar.js index 44e092a..e218ca7 100644 --- a/src/loading-bar.js +++ b/src/loading-bar.js @@ -207,9 +207,13 @@ angular.module('cfp.loadingBar', []) : $document.find($parentSelector)[0] ; - if (! parent) { + if (!parent) { parent = document.getElementsByTagName('body')[0]; } + + if (!parent) { + return; + } var $parent = angular.element(parent); var $after = parent.lastChild && angular.element(parent.lastChild);