@@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
22import { FormGroup , FormBuilder , Validators } from '@angular/forms' ;
33import { ContestService } from '../../services/contest.service' ;
44import { Router , ActivatedRoute } from '@angular/router' ;
5+ import { FlashMessagesService } from 'angular2-flash-messages' ;
56@Component ( {
67 selector : 'app-add-problem' ,
78 templateUrl : './add-problem.component.html' ,
@@ -14,7 +15,8 @@ export class AddProblemComponent implements OnInit {
1415 private contestService : ContestService ,
1516 private router : Router ,
1617 private formBuilder : FormBuilder ,
17- private route : ActivatedRoute
18+ private route : ActivatedRoute ,
19+ private _flashMessagesService : FlashMessagesService
1820 ) { }
1921
2022 ngOnInit ( ) {
@@ -63,8 +65,9 @@ export class AddProblemComponent implements OnInit {
6365
6466 this . contestService . addProblem ( problem , this . contest ) . subscribe ( data => {
6567 if ( ! data . success ) {
66- console . log ( data . msg ) ;
68+ this . _flashMessagesService . show ( data . msg , { cssClass : 'alert-danger' } ) ;
6769 } else {
70+ this . _flashMessagesService . show ( data . msg , { cssClass : 'alert-success' } ) ;
6871 this . router . navigate ( [ '/contest' , this . contest ] ) ;
6972 }
7073 } ) ;
0 commit comments