1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
import {Component,Input,Output,EventEmitter} from '@angular/core';
import {SommaireGestionService} from './sommaire-gestion';
@Component({
selector: 'ajout-matiere',
templateUrl: './app/sommaire/sommaire-ajout.template.html',
})
export class AjoutMatiereComponent {
@Output() onLst = new EventEmitter();
nomMatiere: string;
constructor(private sommaireService: SommaireGestionService) {
}
saisirMat(matiere:string){
let nb_chaine = matiere.lenght;
if(nb_chaine == 0) //si la chaine est vide, on annule le formulaire
{
this.annuler();
}else{
this.sommaireService.addMatiere({id: 0, name:this.nomMatiere});
this.onLst.emit(null);
}
annuler(){
this.onLst.emit(null);
}
} |
Partager