Skip to content

Instantly share code, notes, and snippets.

@capaj
Created October 24, 2015 02:58
Show Gist options
  • Save capaj/bcd2c0d28264bc4c7c50 to your computer and use it in GitHub Desktop.
Save capaj/bcd2c0d28264bc4c7c50 to your computer and use it in GitHub Desktop.
angular 2 when bootstrapping again
browser_adapter.js:64 TypeError: Cannot read property 'insertBefore' of null
STACKTRACE:
TypeError: Cannot read property 'insertBefore' of null
at BrowserDomAdapter.insertAfter (http://localhost:9089/jspm_packages/npm/[email protected]/src/dom/browser_adapter.js:172:18)
at DomRenderer._moveViewNodesAfterSibling (http://localhost:9089/jspm_packages/npm/[email protected]/src/render/dom/dom_renderer.js:277:25)
at DomRenderer.attachViewInContainer (http://localhost:9089/jspm_packages/npm/[email protected]/src/render/dom/dom_renderer.js:125:12)
at AppViewManager.createViewInContainer (http://localhost:9089/jspm_packages/npm/[email protected]/src/core/compiler/view_manager.js:116:20)
at ViewContainerRef.create (http://localhost:9089/jspm_packages/npm/[email protected]/src/core/compiler/view_container_ref.js:44:29)
at NgIf.Object.defineProperty.set [as ngIf] (http://localhost:9089/jspm_packages/npm/[email protected]/src/directives/ng_if.js:37:28)
at BindingRecord.eval [as setter] (eval at <anonymous> (unknown source), <anonymous>:3:15)
at DynamicChangeDetector._updateDirectiveOrElement (http://localhost:9089/jspm_packages/npm/[email protected]/src/change_detection/dynamic_change_detector.js:102:21)
at DynamicChangeDetector.detectChangesInRecords (http://localhost:9089/jspm_packages/npm/[email protected]/src/change_detection/dynamic_change_detector.js:72:14)
at DynamicChangeDetector.AbstractChangeDetector._detectChanges (http://localhost:9089/jspm_packages/npm/[email protected]/src/change_detection/abstract_change_detector.js:52:10)BrowserDomAdapter.logError @ browser_adapter.js:64ExceptionHandler.call @ exception_handler.js:39enforceNoNewChanges._errorHandler @ life_cycle.js:38NgZone._onError @ ng_zone.js:106NgZone._createInnerZone.errorHandling.onError @ ng_zone.js:54run @ core.js:69NgZone._createInnerZone.zone.fork.fork.$run @ ng_zone.js:74zoneBoundFn @ core.js:46
localhost/:1 Uncaught (in promise) TypeError: Cannot read property 'insertBefore' of null
at BrowserDomAdapter.insertAfter (http://localhost:9089/jspm_packages/npm/[email protected]/src/dom/browser_adapter.js:172:18)
at DomRenderer._moveViewNodesAfterSibling (http://localhost:9089/jspm_packages/npm/[email protected]/src/render/dom/dom_renderer.js:277:25)
at DomRenderer.attachViewInContainer (http://localhost:9089/jspm_packages/npm/[email protected]/src/render/dom/dom_renderer.js:125:12)
at AppViewManager.createViewInContainer (http://localhost:9089/jspm_packages/npm/[email protected]/src/core/compiler/view_manager.js:116:20)
at ViewContainerRef.create (http://localhost:9089/jspm_packages/npm/[email protected]/src/core/compiler/view_container_ref.js:44:29)
at NgIf.Object.defineProperty.set [as ngIf] (http://localhost:9089/jspm_packages/npm/[email protected]/src/directives/ng_if.js:37:28)
at BindingRecord.eval [as setter] (eval at <anonymous> (unknown source), <anonymous>:3:15)
at DynamicChangeDetector._updateDirectiveOrElement (http://localhost:9089/jspm_packages/npm/[email protected]/src/change_detection/dynamic_change_detector.js:102:21)
at DynamicChangeDetector.detectChangesInRecords (http://localhost:9089/jspm_packages/npm/[email protected]/src/change_detection/dynamic_change_detector.js:72:14)
at DynamicChangeDetector.AbstractChangeDetector._detectChanges (http://localhost:9089/jspm_packages/npm/[email protected]/src/change_detection/abstract_change_detector.js:52:10)
@danrasmuson
Copy link

@capaj You can re-bootstrap angular 1 and 2 apps by recreating the body element.

var newBody = document.createElement('body')
newBody.appendChild(document.createElement('app')) /**Your selector tag*/
document.body = newBody;

bootstrap(MyApp, []);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment