angular - TypeError: Invalid Event Target - But just by using direct Route -


the application has following component implemented

customer-overview.component.ts

import { component, oninit, elementref, viewchild } '@angular/core' import { router } '@angular/router' import { datasource } '@angular/cdk'  import { behaviorsubject } 'rxjs/behaviorsubject'; import { observable } 'rxjs/observable'; import 'rxjs/add/operator/startwith'; import 'rxjs/add/observable/merge'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/debouncetime'; import 'rxjs/add/operator/distinctuntilchanged'; import 'rxjs/add/observable/fromevent';  import { customeroverviewservice, customeroverviewdatasource } './../../services/customer-overview.service'  @component({     selector: 'customer-overview-component',     templateurl: 'customer-overview.component.html',     styleurls: ['./customer-overview.component.css'],      providers: [customeroverviewservice] }) export class customeroverviewcomponent implements oninit {     private _dataservice: customeroverviewservice;     public datasource: customeroverviewdatasource | null;      @viewchild('filter') filter: elementref;      constructor(private dataservice: customeroverviewservice, private router: router) {         this._dataservice = dataservice;         this.datasource = new customeroverviewdatasource(this._dataservice);     }      ngoninit() {         observable.fromevent(this.filter.nativeelement, 'keyup')                 .debouncetime(150)                 .distinctuntilchanged()                 .subscribe(() => {                     if (!this.datasource) { return; }                     this.datasource.filter = this.filter.nativeelement.value;                 });     } } 

the routing defined following

app.module.client.ts

    const approutes: routes = [         {             path: '',             component: homecomponent         }         {             path: 'customer',             component: customeroverviewcomponent         }     ]       @ngmodule({         bootstrap: sharedconfig.bootstrap,         declarations: sharedconfig.declarations,         imports: [         routermodule.forroot(                 approutes,                 { enabletracing: true }),             browsermodule,             formsmodule,             httpmodule,             browseranimationsmodule,             sharedmodule,          ],         providers: [             customeroverviewservice,             ...sharedconfig.providers,             { provide: 'origin_url', usevalue: location.origin }         ]     }) 

the component works fine without error via console or getting 500 via network protocol. when use direct link localhost/customer, following error.

an unhandled exception occurred while processing request.

exception: call node module failed error: error: uncaught (in promise): typeerror: invalid event target typeerror: invalid event target @ function.fromeventobservable.setupsubscription

i tried use observable.fromevent in ngafterviewinit , in constructor, none of helped. missing here?


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -