-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
131 additions
and
533 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { FormsModule } from '@angular/forms'; | ||
|
||
import { MainPageComponent } from './main-page/main-page.component'; | ||
|
||
|
||
@NgModule({ | ||
declarations: [MainPageComponent], | ||
exports:[ | ||
MainPageComponent | ||
], | ||
imports: [ | ||
CommonModule, | ||
FormsModule, | ||
] | ||
}) | ||
export class DbzModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
Esta interface es para que generemos | ||
un objeto para los personajes de la app | ||
*/ | ||
|
||
interface Personajes{ | ||
nombre: string, | ||
poder: number, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<div class="container main-container"> | ||
|
||
<h1>Dragon Ball Z</h1> | ||
<hr> | ||
|
||
<div class="row"> | ||
<div class="col"> | ||
<h3>Personajes</h3> | ||
<hr> | ||
<ul *ngFor="let personaje of personajes"> | ||
|
||
<li>{{ personaje.nombre }} - {{personaje.poder|number}}</li> | ||
</ul> | ||
</div> | ||
<div class="col"> | ||
<h3>Agregar</h3> | ||
<hr> | ||
<form (ngSubmit)="agregar()"> | ||
<input | ||
type="text" | ||
placeholder="Nombre" | ||
class="form-control" | ||
name="nombre" | ||
[(ngModel)]=" nuevo.nombre" | ||
> | ||
|
||
<input | ||
type="number" | ||
placeholder="Poder" | ||
class="form-control" | ||
name="poder" | ||
[(ngModel)]=" nuevo.poder" | ||
> | ||
|
||
<br> | ||
<button type="submit" | ||
class="btn btn-outline-primary w-100"> | ||
Agregar... | ||
</button> | ||
</form> | ||
|
||
</div> | ||
</div> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Component } from '@angular/core'; | ||
import '../interfaces/dbz.interface' | ||
|
||
|
||
@Component({ | ||
selector: 'app-main-page', | ||
templateUrl: './main-page.component.html' | ||
}) | ||
export class MainPageComponent { | ||
|
||
personajes:Personajes[] = [ | ||
{ | ||
nombre:'Krilin', | ||
poder: 800, | ||
}, | ||
{ | ||
nombre:'Goku', | ||
poder: 14500, | ||
} | ||
]; | ||
|
||
nuevo:Personajes = { | ||
nombre: '', | ||
poder: 0, | ||
} | ||
|
||
agregar(){ | ||
|
||
if(this.nuevo.nombre.trim().length===0){ return; } | ||
|
||
console.log(this.nuevo); | ||
// this.peronajes.push(this.nuevo); | ||
this.personajes.push(this.nuevo); | ||
this.nuevo = { | ||
nombre:'', | ||
poder:0, | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,6 @@ | ||
/* You can add global styles to this file, and also import other style files */ | ||
|
||
|
||
.main-container{ | ||
margin-top: 30px; | ||
} |