File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11< div class ="container ">
2- < div *ngIf ="hero ">
2+ < div *ngIf ="hero; else noHero ">
33 < h2 > {{hero.name}} {{ 'details' | translate }}!</ h2 >
44 < div class ="input-group ">
55 < span class ="input-group-addon " id ="hero-id "> Id</ span >
@@ -22,4 +22,7 @@ <h2>{{hero.name}} {{ 'details' | translate }}!</h2>
2222 < button class ="btn btn-secondary " (click) ="goBack() "> {{ 'back' | translate }}</ button >
2323 < button class ="btn btn-primary " (click) ="saveHero() "> {{ 'saveHero' | translate }}</ button >
2424 </ div >
25+ < ng-template #noHero >
26+ < p > {{'noHero' | translate}}</ p >
27+ </ ng-template >
2528</ div >
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ export class HeroService {
1212 private heroesUrl ;
1313
1414 private static handleError ( error : any ) : Promise < any > {
15- window . alert ( error . _body ) ;
1615 return Promise . reject ( error . message || error ) ;
1716 }
1817
Original file line number Diff line number Diff line change 2626 "cancel" : " Cancel" ,
2727 "remove" : " Remove" ,
2828 "findHero" : " Find a hero" ,
29- "back" : " Back"
29+ "back" : " Back" ,
30+ "noHero" : " There is no hero!"
3031}
Original file line number Diff line number Diff line change 2626 "cancel" : " Cancelar" ,
2727 "remove" : " Eliminar" ,
2828 "findHero" : " Busca un heroe" ,
29- "back" : " Atras"
29+ "back" : " Atras" ,
30+ "noHero" : " No hay heroe!"
3031}
You can’t perform that action at this time.
0 commit comments