2016-08-05 3 views
0

서비스에서 채팅 메시지를 가져 오는 Angular2 앱으로 게임을합니다. 푸시 알림이 주어지면 앱은 서비스의 모든 메시지를 다시 가져옵니다. 이것은 IE를 제외한 모든 브라우저에서 잘 작동합니다. 푸시 알림 기능은 정상적으로 작동하며 앱은 모든 메시지가 IE에서도 올바르게 반입된다는 것을 기록하지만 브라우저가 업데이트 된 콘텐츠를 다시 렌더링하지 않는 것으로 보입니다. (IE 11). 이것이 일어나지 않는 이유에 대한 제안?Angular2 페이지가 업데이트되었지만 IE에는 없습니다

구성 요소 발췌 :

ngOnInit(){ 
     this.getMessages(); 
     this.pusher = new Pusher('PUSHER_KEY'); 
     this.channel = this.pusher.subscribe('test_channel'); 
     this.channel.bind('my_event', (data) =>{ 
         this.getMessages(); 
      }); 
     console.log('In OnInit'); 
    } 

    sendMessage(message:string): void{ 
     this._service.postMessage(this.id, message); 
     console.log('Send Message called'); 
    } 

    getMessages():void{ 
     this._service.getMessages(this.id) 
      .subscribe(
       messages => this.messages = messages, 
       error => this.errorMessage = <any>error); 
    } 

템플릿 :

<div class="panel-body"> 
     <div class="row"> 
      <div class="col-md-2">Add Message: </div> 
      <div class="col-md-2"><input type="text" [(ngModel)]='newMessage' /> <button class="btn btn-primary" (click)='sendMessage(newMessage)'>Send</button></div> 
     </div> 
     <div class="table-responsive"> 
      <table class="table" *ngIf='messages && messages.length'> 
       <thead> 
        <tr> 
         <th>Messages</th> 
        </tr> 
       </thead> 
       <tbody> 
        <tr *ngFor='#message of messages'> 
         <td>{{message}}</td> 
        </tr> 
       </tbody> 
      </table> 
     </div> 
</div> 

답변

0

이 도움이 확실하지만 이럴 가치가 아니 어떤 경이로움을하지 않았다 this.zone를 사용하여, 불행하게도

constructor(private zone:NgZone) {} 

ngOnInit(){ 
    this.getMessages(); 
    this.pusher = new Pusher('PUSHER_KEY'); 
    this.channel = this.pusher.subscribe('test_channel'); 
    this.channel.bind('my_event', (data) =>{ 
     this.zone.run(() => this.getMessages()); 
    }); 
    console.log('In OnInit'); 
} 
+0

시도 IE 행동에. – kenander

+0

이 재현하려면 Plunker가 필요합니다. –

관련 문제