I encountered an issue with my Angular2 code:
import 'babel-polyfill';
import 'zone.js/dist/zone';
import { bootstrap } from "@angular/platform-browser-dynamic";
import { Component, ViewChild } from '@core';
import Other from "./Other";
@Component({
selector: "app",
templateUrl: "app.html",
// directives: [Other]
})
export default class AppComponent {
// @ViewChild(Other) other: Other;
constructor() {
}
}
bootstrap(AppComponent);
When I uncomment the commented lines, I receive the following error:
EXCEPTION: TypeError: Cannot read property 'query' of null (index):68
EXCEPTION: Error: Uncaught (in promise): TypeError: Cannot read property 'query' of null (index):76
STACKTRACE:window.console.error @ (index):76
BrowserDomAdapter.logError @ browser_adapter.js:77
ExceptionHandler.call @ exception_handler.js:59
(anonymous function) @ application_ref.js:265
schedulerFn @ async.js:123
SafeSubscriber.__tryOrUnsub @ Subscriber.js:225
SafeSubscriber.next @ Subscriber.js:174
Subscriber._next @ Subscriber.js:124
Subscriber.next @ Subscriber.js:88
Subject._finalNext @ Subject.js:128
Subject._next @ Subject.js:120
Subject.next @ Subject.js:77
EventEmitter.emit @ async.js:112
NgZone._zoneImpl.ng_zone_impl_1.
NgZoneImpl.onError @ ng_zone.js:120
NgZoneImpl.inner.inner.fork.onHandleError @ ng_zone_impl.js:66
ZoneDelegate.handleError @ zone.js:327
Zone.runGuarded @ zone.js:233
_loop_1 @ zone.js:487
drainMicroTaskQueue @ zone.js:494
ZoneTask.invoke @ zone.js:426 (index):76
...
(index):76
Unhandled Promise rejection:window.console.error @ (index):76
consoleError @ zone.js:461
_loop_1 @ zone.js:490
drainMicroTaskQueue @ zone.js:494
ZoneTask.invoke @ zone.js:426
(index):76
Error: Uncaught (in promise): TypeError: Cannot read property 'query' of null(…)window.console.error @ (index):76
consoleError @ zone.js:463
_loop_1 @ zone.js:490
drainMicroTaskQueue @ zone.js:494
ZoneTask.invoke @ zone.js:426
socket.io.js:5120
Uncaught RangeError: Maximum call stack size exceeded