Rxjs-DOM load function does not fire angular 2 -


i working on angular 2 project need call specific functions , after elements on page loaded. tried use eventfrom function observable, worked when expecting 'click' operation, once switched 'load" did not fire @ all. next tried use rxjs-dom load function , not fire either.

here code have right now:

ngafterviewinit(): void {    let input = this.container.nativeelement.getelementsbyclassname('list-item');      let source = rx.dom.load(input);      let subscription = source.subscribe((x) => {        console.log('next!');      },      (err) => {        console.log('error: ' + err);      },      () => {        let temp = this.container.nativeelement.getelementsbyclassname('list-item');        console.log(temp.length);      });    }
<div class="list-wrapper">    <div class="list">      <div class="list-item" *ngfor="let item of items">        <img src={{item.image}} alt="{{item.title}}">      </div>    </div>  </div>

 "@angular/core": "4.0.1",     "@types/rx-dom": "^7.0.0",     "angular2-infinite-scroll": "0.3.4",     "gulp-run": "1.7.1",     "rxjs": "5.2.1-smooth" 

temp.length 0. if set timeout there work elements 2-3 seconds load , temp not empty. timeout not desirable in case. there doing wrong? questions if there other way in angular 2 call functions after dom elements loaded.

thank in advance.

try ngzone.run. let angular rerender latest model.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -