I'm currently working on developing an Instagram-inspired platform using Angular 6, but I've run into a puzzling issue. When I refresh the page in my home component, everything reloads correctly and displays all my posts as expected. However, if I try to do the same on the profile page, it doesn't refresh the content; instead, it redirects me back to the home page without updating the profile section. https://example.com/DPO8g.jpg
Interestingly, after the initial refresh, everything works smoothly.
Profile View https://example.com/jHK5r.png
After the Refresh https://example.com/LHSHy.png
app.routes
import {Routes} from '@angular/router'
import { AcessoComponent } from './acesso/acesso.component';
import { HomeComponent } from './home/home.component';
import { AutenticacaoGuard } from './autenticacao-guard.service';
import { ProfileComponent } from './profile/profile.component';
export const ROUTES: Routes = [
{path:'', component:AcessoComponent},
{ path: "home", component: HomeComponent, canActivate:[AutenticacaoGuard]},
{ path: "profile", component: ProfileComponent, canActivate:[AutenticacaoGuard]}
]
Profile.ts
export class ProfileComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
home.ts
export class HomeComponent implements OnInit {
@ViewChild('publicacoes') public publicacoes:any;
constructor() { }
ngOnInit() {}
public atualizarTimeLine(){
this.publicacoes.atualizarTimeLine();
}
}
Why might this unexpected behavior be occurring?