Home > front end >  ERROR : Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'chat/1' Angul
ERROR : Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'chat/1' Angul

Time:11-11

i have a chat button that allows admin to see the chat between users, when i press that it opens Chat details. it is working fine on localhost but when i have out it live then it is no working. I am having the issue

Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'chat/1'

.html code

`<tbody>
  <tr *ngFor="let row of taskerDetail; let i = index">
      <td>{{ i   1 }}</td>
      <td>{{ row.job_post.what_do_you }}</td>
      <td>{{ row.from_chat.first_name }} {{ row.from_chat.last_name }}</td>
      <td>{{ row.to_chat.first_name }} {{ row.to_chat.last_name }}</td>
      <td > 
      <a  [routerLink]="['/chat', row.id]">
          <i > </i>
             Chat
      </a>
   </td>
  </tr>
</tbody>`

.ts code


`import { RouterModule } from '@angular/router';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ChatsComponent } from './Chats.component';
import { ModalModule } from 'ngx-bootstrap/modal';
import { PopoverModule } from 'ngx-bootstrap/popover';

@NgModule({
  imports: [
    CommonModule,
    PopoverModule.forRoot(),
    ModalModule.forRoot(),
    RouterModule.forChild([
      {
        path: '',
        component: ChatsComponent
      }
    ])
  ],
  declarations: [ChatsComponent]
})
export class ChatsModule { }`

Website routing.ts code


`{
        path: 'chats',
        loadChildren: () => import('./Chats/Chats.module')
        .then(mod => mod.ChatsModule)
      }`


CodePudding user response:

  1. Go to firebase console.
  2. Go to realtime chat and make the chat empty
  3. Go to you database and make the messages table empty.

These steps are just to make sure that if any old chat isn't present

  1. Go to your server and login
  2. Find Speed and click Dynamic Cache
  3. Clear cache for all concerned domains you have.

As Angular cache is hard to clear.

then check, it will work

  • Related