角度,链接已更改,但页面没有加载
当我单击 skip 时,我想转到下一个单词,但是当我单击 skip 时,链接更改了,但是下一个单词并未出现在旧单词中,并且控制台中没有错误消息。这是 skip 按钮的代码:
next() {
this.lessonService.getNextLessonElement(this.elementId).subscribe({
next: response => {
console.log('go to level')
console.log('/level/'+this.lessonId+'/'+response.id)
this.router.navigate(['/level/'+this.lessonId+'/'+response.id]);
// this.router.navigate(['level']);
}
, error: (err: AppError) => {
if (err instanceof NotFoundError) {
console.log(err)
}
}
})
}
<div class="flex-column flex-center">
<div class="block">
<h2 class="title">Try to repeat this word:</h2>
</div>
<div class="flex-row">
<h3 class="sentence">{{ element.element }}</h3>
<i
class="fa fa-volume-off fa-3x block micro"
(click)="textToSpeech(element.element || 'undefined')"
></i>
</div>
<div *ngIf="!recording" (click)="startRecording()" class="mic">
<i class="fa fa-microphone fa-5x micro" aria-hidden="true"></i>
Start Recording
</div>
<div *ngIf="recording" (click)="stopRecording()" class="mic">
<i
class="fa fa-microphone fa-5x"
aria-hidden="true"
style="color: red"
></i>
<div style="color: red">Stop Recording</div>
</div>
<audio controls="" *ngIf="url">
<source [src]="sanitize(url)" type="audio/wav" />
</audio>
</div>
<button mat-flat-button color="warn" (click)="next()">Skip</button>
const routes: Routes = [
path: 'level', component: LevelComponent },
path: 'level/:lessonid/:elementid', component: LevelComponent },
];
I want to go to the next word when I click Skip, but when I click Skip the link changed but the next word doesn't appear in place of the old word, and there are no error messages in the console. This is the code for the Skip button:
next() {
this.lessonService.getNextLessonElement(this.elementId).subscribe({
next: response => {
console.log('go to level')
console.log('/level/'+this.lessonId+'/'+response.id)
this.router.navigate(['/level/'+this.lessonId+'/'+response.id]);
// this.router.navigate(['level']);
}
, error: (err: AppError) => {
if (err instanceof NotFoundError) {
console.log(err)
}
}
})
}
<div class="flex-column flex-center">
<div class="block">
<h2 class="title">Try to repeat this word:</h2>
</div>
<div class="flex-row">
<h3 class="sentence">{{ element.element }}</h3>
<i
class="fa fa-volume-off fa-3x block micro"
(click)="textToSpeech(element.element || 'undefined')"
></i>
</div>
<div *ngIf="!recording" (click)="startRecording()" class="mic">
<i class="fa fa-microphone fa-5x micro" aria-hidden="true"></i>
Start Recording
</div>
<div *ngIf="recording" (click)="stopRecording()" class="mic">
<i
class="fa fa-microphone fa-5x"
aria-hidden="true"
style="color: red"
></i>
<div style="color: red">Stop Recording</div>
</div>
<audio controls="" *ngIf="url">
<source [src]="sanitize(url)" type="audio/wav" />
</audio>
</div>
<button mat-flat-button color="warn" (click)="next()">Skip</button>
const routes: Routes = [
path: 'level', component: LevelComponent },
path: 'level/:lessonid/:elementid', component: LevelComponent },
];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论