Subscribe Router Params . Set OnRouter Change. On Url Change. Subscribe to router.

Angular 8+ Router Change Event.

 getParticipantsPhotos(objID) {
    // update contacts when route change
    this.router.params.subscribe(res => {
        // find the object id
        const ids = this.allPhotos.find(x => x.ObjectID === objID);
        this.allPertiPhotos = [];
        console.log(this.allPertiPhotos);
        ids.lstDetail.forEach(element => {
            const getAllPhoto: PhotoModel = {
                ObjectID: element.ObjectID,
                master: '',
                MessageData: '',
                lstDetail: element.Data,
            };
            this.allPertiPhotos.push(getAllPhoto);
        });
    });
    // new code 
}