chat.component.ts
import { Component, OnInit, Inject } from '@angular/core'; import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { SnackBarComponent } from 'src/app/core/snack-bar/snack-bar.component'; import { ChatService } from '../services/chat.service'; import { ConversartionModel, ChatConversartionModel } from './chat.conversation.model'; import { MAT_DIALOG_DATA } from '@angular/material/dialog'; @Component({ selector: 'app-chat', templateUrl: './chat.component.html', styleUrls: ['./chat.component.scss'] }) export class ChatComponent implements OnInit { roomCriada: string; chatComponentFormGroup: FormGroup; conversartions: ConversartionModel[] = []; constructor( private snackbar: SnackBarComponent, private formBuilder: FormBuilder, private chatService: ChatService, @Inject(MAT_DIALOG_DATA) data ) { this.roomCriada = data.room; } ngOnInit(): void { this.criarFormGroup(); this.fetchMessages(); } sendMessage(): void { if (this.chatComponentFormGroup.invalid) { if (this.chatComponentFormGroup.get("message").errors != null) { this.snackbar.openSnackBar( 'Message is required !', 'error' ); return; } return; } this.chatService.createMessage( this.roomCriada, this.chatComponentFormGroup.get("message").value, ).subscribe( (mensagemEnviada: any) => { this.snackbar .openSnackBar( mensagemEnviada.message, 'success' ); this.fetchMessages(); } ); } private criarFormGroup() { this.chatComponentFormGroup = this.formBuilder.group({ message: new FormControl('', Validators.compose([ Validators.required ]) ) }); } private fetchMessages() { this.chatService.fetchMessages(this.roomCriada) .subscribe( (conversartions: any[]) => this.conversartions = conversartions ); } }
chat.service.ts
import { HttpClient } from '@angular/common/http'; import { Injectable, EventEmitter } from '@angular/core'; import { TELEMONITORING_API } from 'src/app/services/telemonitoring.api'; import { LoginService } from '../../login/services/login.service'; import { ChatConversartionModel, ConversartionModel, MessageModel } from '../chat/chat.conversation.model'; @Injectable({ providedIn: 'root' }) export class ChatService { caminho = 'messages'; chatsConversation: ChatConversartionModel = new ChatConversartionModel; chatListOdd: string = "chat-list odd"; chatListEven: string = "chat-list even"; constructor( private loginService: LoginService, private httpClient: HttpClient ) { } createMessage(room: string, subject: string) { let mensagem: MessageModel = new MessageModel; mensagem.textMessage = subject; return this.httpClient.post( `${TELEMONITORING_API}` + this.caminho + '/' + room, mensagem ); } countMessage(room: string) { this.countMessageOpened(room); } public deleteMessages() { } fetchMessages(room: string) { return this.httpClient.get( `${TELEMONITORING_API}` + this.caminho + '/' + room ); } private countMessageOpened(room: string) { this.fetchMessages(room).subscribe( (valor: any[]) => { console.log('Total: ' + valor.length) } ); } private conversartion(subject: string, conversartions: ConversartionModel[]) { let conversartion = new ConversartionModel; conversartion.name = String(this.loginService.nameLogged); conversartion.class = this.chatListEven; conversartion.dateTime = new Date(); conversartion.subject = subject; conversartion.opened = true; conversartions.push(conversartion); } }
chat.component.html
<mat-toolbar color="primary">Chat</mat-toolbar> <mat-card> <mat-card-actions class="chat-footer"> <div class="form-wrapper" fxLayout="row" layout-align="start center"> <form class="form-form" [formGroup]="chatComponentFormGroup"> <mat-form-field class="form-full-width"> <textarea matInput placeholder="Send message" id="message" formControlName="message" name="message" #message> </textarea> <mat-hint align="end">{{message.value.length}}</mat-hint> </mat-form-field> <button mat-mini-fab color="warn" (click)="sendMessage()"> <mat-icon>send</mat-icon> </button> </form> </div> </mat-card-actions> </mat-card> <mat-card class="mat-card-top"> <mat-card-content class="chat-middle-box"> <div *ngFor="let conversation of conversartions"> <div class="chat-message"> <div class="chat-block"> <span>{{conversation.subject}}</span> </div> <span class="chat-date">{{conversation.dateTime | date: 'medium' }}</span> </div> </div> </mat-card-content> </mat-card>
Ao entrar no componente ele mostra este erro:
core.js:6185 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value for 'hidden': 'true'. Current value: 'false'. at throwErrorIfNoChangesMode (core.js:8092) at bindingUpdated (core.js:19773) at Module.ɵɵproperty (core.js:20921) at LoaderComponent_Template (loader.component.html:1) at executeTemplate (core.js:11949) at refreshView (core.js:11796) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshComponent (core.js:13229) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onHasTask @ core.js:41387 hasTask @ zone-evergreen.js:419 _updateTaskCount @ zone-evergreen.js:440 _updateTaskCount @ zone-evergreen.js:263 runTask @ zone-evergreen.js:184 drainMicroTaskQueue @ zone-evergreen.js:569 invokeTask @ zone-evergreen.js:484 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 loader.component.ts:18 false core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvokeTask @ core.js:41350 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1658 load (async) customScheduleGlobal @ zone-evergreen.js:1773 scheduleTask @ zone-evergreen.js:385 onScheduleTask @ zone-evergreen.js:272 scheduleTask @ zone-evergreen.js:378 scheduleTask @ zone-evergreen.js:210 scheduleEventTask @ zone-evergreen.js:236 (anonymous) @ zone-evergreen.js:1928 (anonymous) @ http.js:2602 _trySubscribe @ Observable.js:42 subscribe @ Observable.js:28 call @ finalize.js:11 subscribe @ Observable.js:23 call @ retry.js:11 subscribe @ Observable.js:23 call @ catchError.js:16 subscribe @ Observable.js:23 subscribeToResult @ subscribeToResult.js:9 _innerSub @ mergeMap.js:59 _tryNext @ mergeMap.js:53 _next @ mergeMap.js:36 next @ Subscriber.js:49 (anonymous) @ subscribeToArray.js:3 _trySubscribe @ Observable.js:42 subscribe @ Observable.js:28 call @ mergeMap.js:21 subscribe @ Observable.js:23 call @ filter.js:13 subscribe @ Observable.js:23 call @ map.js:16 subscribe @ Observable.js:23 fetchMessages @ chat.component.ts:72 ngOnInit @ chat.component.ts:30 callHook @ core.js:4686 callHooks @ core.js:4650 executeInitAndCheckHooks @ core.js:4591 refreshView @ core.js:11814 refreshDynamicEmbeddedViews @ core.js:13154 refreshView @ core.js:11819 refreshComponent @ core.js:13229 refreshChildComponents @ core.js:11527 refreshView @ core.js:11848 renderComponentOrTemplate @ core.js:11922 tickRootContext @ core.js:13391 detectChangesInRootView @ core.js:13425 detectChanges @ core.js:15103 tick @ core.js:42809 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onHasTask @ core.js:41387 hasTask @ zone-evergreen.js:419 _updateTaskCount @ zone-evergreen.js:440 _updateTaskCount @ zone-evergreen.js:263 runTask @ zone-evergreen.js:184 drainMicroTaskQueue @ zone-evergreen.js:569 invokeTask @ zone-evergreen.js:484 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 Show 69 more frames core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvokeTask @ core.js:41350 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 ZoneTask.invoke @ zone-evergreen.js:469 timer @ zone-evergreen.js:2552 setTimeout (async) scheduleTask @ zone-evergreen.js:2573 scheduleTask @ zone-evergreen.js:385 onScheduleTask @ zone-evergreen.js:272 scheduleTask @ zone-evergreen.js:378 scheduleTask @ zone-evergreen.js:210 scheduleMacroTask @ zone-evergreen.js:233 scheduleMacroTaskWithCurrentZone @ zone-evergreen.js:1134 (anonymous) @ zone-evergreen.js:2586 proto.<computed> @ zone-evergreen.js:1449 hide @ tooltip.js:1010 hide @ tooltip.js:429 (anonymous) @ tooltip.js:258 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 (anonymous) @ tooltip.js:255 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 (anonymous) @ a11y.js:3158 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 _emitOrigin @ a11y.js:3155 _onBlur @ a11y.js:3146 blurListener @ a11y.js:2918 invokeTask @ zone-evergreen.js:399 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCaptureCallback @ zone-evergreen.js:1679 (anonymous) @ dialog.js:449 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 (anonymous) @ zone-evergreen.js:857 invokeTask @ zone-evergreen.js:399 onInvokeTask @ core.js:41344 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 drainMicroTaskQueue @ zone-evergreen.js:569 invokeTask @ zone-evergreen.js:484 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 Show 52 more frames core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvoke @ core.js:41369 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 (anonymous) @ animations.js:363 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 (anonymous) @ zone-evergreen.js:857 invokeTask @ zone-evergreen.js:399 runTask @ zone-evergreen.js:167 drainMicroTaskQueue @ zone-evergreen.js:569 invokeTask @ zone-evergreen.js:484 ZoneTask.invoke @ zone-evergreen.js:469 timer @ zone-evergreen.js:2552 setTimeout (async) scheduleTask @ zone-evergreen.js:2573 scheduleTask @ zone-evergreen.js:385 onScheduleTask @ zone-evergreen.js:272 scheduleTask @ zone-evergreen.js:378 scheduleTask @ zone-evergreen.js:210 scheduleMacroTask @ zone-evergreen.js:233 scheduleMacroTaskWithCurrentZone @ zone-evergreen.js:1134 (anonymous) @ zone-evergreen.js:2586 proto.<computed> @ zone-evergreen.js:1449 hide @ tooltip.js:1010 hide @ tooltip.js:429 (anonymous) @ tooltip.js:258 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 (anonymous) @ tooltip.js:255 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 (anonymous) @ a11y.js:3158 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 _emitOrigin @ a11y.js:3155 _onBlur @ a11y.js:3146 blurListener @ a11y.js:2918 invokeTask @ zone-evergreen.js:399 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCaptureCallback @ zone-evergreen.js:1679 (anonymous) @ dialog.js:449 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 (anonymous) @ zone-evergreen.js:857 invokeTask @ zone-evergreen.js:399 onInvokeTask @ core.js:41344 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 drainMicroTaskQueue @ zone-evergreen.js:569 invokeTask @ zone-evergreen.js:484 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 Show 60 more frames core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvokeTask @ core.js:41350 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 ZoneTask.invoke @ zone-evergreen.js:469 timer @ zone-evergreen.js:2552 setTimeout (async) scheduleTask @ zone-evergreen.js:2573 scheduleTask @ zone-evergreen.js:385 onScheduleTask @ zone-evergreen.js:272 scheduleTask @ zone-evergreen.js:378 scheduleTask @ zone-evergreen.js:210 scheduleMacroTask @ zone-evergreen.js:233 scheduleMacroTaskWithCurrentZone @ zone-evergreen.js:1134 (anonymous) @ zone-evergreen.js:2586 proto.<computed> @ zone-evergreen.js:1449 hide @ tooltip.js:1010 _handleBodyInteraction @ tooltip.js:1069 TooltipComponent_click_HostBindingHandler @ tooltip.js:1084 executeListenerWithErrorHandling @ core.js:21693 wrapListenerIn_markDirtyAndPreventDefault @ core.js:21735 (anonymous) @ platform-browser.js:934 invokeTask @ zone-evergreen.js:399 onInvokeTask @ core.js:41344 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvokeTask @ core.js:41350 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 ZoneTask.invoke @ zone-evergreen.js:469 timer @ zone-evergreen.js:2552 setTimeout (async) scheduleTask @ zone-evergreen.js:2573 scheduleTask @ zone-evergreen.js:385 onScheduleTask @ zone-evergreen.js:272 scheduleTask @ zone-evergreen.js:378 scheduleTask @ zone-evergreen.js:210 scheduleMacroTask @ zone-evergreen.js:233 scheduleMacroTaskWithCurrentZone @ zone-evergreen.js:1134 (anonymous) @ zone-evergreen.js:2586 proto.<computed> @ zone-evergreen.js:1449 hide @ tooltip.js:1010 hide @ tooltip.js:429 (anonymous) @ tooltip.js:670 invokeTask @ zone-evergreen.js:399 onInvokeTask @ core.js:41344 invokeTask @ zone-evergreen.js:398 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1658 core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvoke @ core.js:41369 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 scheduleListenerCallback @ animations.js:352 (anonymous) @ animations.js:715 (anonymous) @ browser.js:134 (anonymous) @ browser.js:134 (anonymous) @ browser.js:8257 _onFinish @ browser.js:8253 (anonymous) @ browser.js:8284 invokeTask @ zone-evergreen.js:399 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 Show 9 more frames core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvoke @ core.js:41369 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 (anonymous) @ animations.js:363 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 (anonymous) @ zone-evergreen.js:857 invokeTask @ zone-evergreen.js:399 runTask @ zone-evergreen.js:167 drainMicroTaskQueue @ zone-evergreen.js:569 invokeTask @ zone-evergreen.js:484 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 Show 7 more frames core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed at DefaultIterableDiffer.diff (core.js:28238) at NgForOf.ngDoCheck (common.js:4353) at callHook (core.js:4690) at callHooks (core.js:4650) at executeCheckHooks (core.js:4572) at refreshView (core.js:11807) at refreshComponent (core.js:13229) at refreshChildComponents (core.js:11527) at refreshView (core.js:11848) at refreshDynamicEmbeddedViews (core.js:13154) defaultErrorLogger @ core.js:6185 handleError @ core.js:6238 (anonymous) @ core.js:42822 invoke @ zone-evergreen.js:364 run @ zone-evergreen.js:123 runOutsideAngular @ core.js:41202 tick @ core.js:42819 (anonymous) @ core.js:42659 invoke @ zone-evergreen.js:364 onInvoke @ core.js:41366 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 next @ core.js:42656 schedulerFn @ core.js:36886 __tryOrUnsub @ Subscriber.js:183 next @ Subscriber.js:122 _next @ Subscriber.js:72 next @ Subscriber.js:49 next @ Subject.js:39 emit @ core.js:36848 checkStable @ core.js:41280 onLeave @ core.js:41441 onInvoke @ core.js:41369 invoke @ zone-evergreen.js:363 run @ zone-evergreen.js:123 run @ core.js:41141 scheduleListenerCallback @ animations.js:352 (anonymous) @ animations.js:715 (anonymous) @ browser.js:134 (anonymous) @ browser.js:134 (anonymous) @ browser.js:8257 _onFinish @ browser.js:8253 (anonymous) @ browser.js:8284 invokeTask @ zone-evergreen.js:399 runTask @ zone-evergreen.js:167 invokeTask @ zone-evergreen.js:480 invokeTask @ zone-evergreen.js:1621 globalZoneAwareCallback @ zone-evergreen.js:1647 Show 9 more frames core.js:6185 ERROR Error: Error trying to diff '[object Object]'. Only arrays and iterables are allowed
Se tiro o método fetchMessages(), ele não mostra o erro
Pelo que entendi ele da erro em :
`
`
O que pode ser ?