Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addFlashcards(){
- this.testService.addTest(this.createTest()).subscribe(result => {
- this.editTest = result;
- console.log(result);
- }, error => console.error(error))
- let isPossible: boolean = true;
- let i: number = 0;
- this.wordsW.forEach(element => {
- if(element == "") isPossible = false;
- if(this.translatedWords[i] == "") isPossible = false;
- if(this.sentence[i] == "") isPossible = false;
- if(this.translatedSentence[i] == "") isPossible = false;
- i++;
- });
- if(isPossible){
- console.log(this.editTest.Id)
- this.testService.addFlashcards(this.createFlashcards(this.editTest.Id)).subscribe(result => {
- console.log(result.toString())
- this.messageService.success("Created new flashcards");
- this.router.navigateByUrl('/tests/add', { skipLocationChange: true }).then(() => {
- this.router.navigate(['/tests/add']);
- });
- }, error => console.error(error));
- } else {
- this.messageService.error("Invalid form");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement