SlideShare ist ein Scribd-Unternehmen logo
1 von 6
Downloaden Sie, um offline zu lesen
Team.services
public addTeam(team:Team){
const formData = new FormData()
formData.append("name", team.name)
formData.append("trophy", team.trophy)
formData.append("image", team.image)
return this.http.post(this.url, formData)
}
public deleteTeam(id:string){
return this.http.delete(this.url+'?id='+id)
}
public getTeam(id:string){
return this.http.get<Team>(this.url+'?id='+id)
}
public updateTeam(team:Team){
return this.http.put(this.url, team)
}
}
Home.page.html
<ion-header [translucent]="true">
<ion-toolbar color="tertiary">
<ion-title>Productos</ion-title>
<ion-buttons slot="end">
<ion-button color="success" fill="outline"
(click)="openAndCloseModal()">
Agregar Producto</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content [fullscreen]="true">
<ion-header collapse="condense">
<ion-toolbar>
<ion-title size="large">Football Teams</ion-title>
</ion-toolbar>
</ion-header>
<div id="container" >
<ion-list *ngIf="bandera == false">
<ion-list-header>
<ion-label>imagen</ion-label>
<ion-label>producto</ion-label>
<ion-label>precio</ion-label>
<ion-label>opciones</ion-label>
</ion-list-header>
<ion-item *ngFor="let team of ListTeam">
<ion-grid>
<ion-row>
<ion-col>
<ion-avatar>
<img src={{team.image}}>
</ion-avatar>
</ion-col>
<ion-col>
<ion-label>{{team.name}}</ion-label>
</ion-col>
<ion-col>
<ion-label>{{team.trophy}}</ion-label>
</ion-col>
<ion-col>
<ion-button color="warning" (click)="getTeam(team.id)">
<ion-icon name="pencil"></ion-icon>
</ion-button>
<ion-button color="danger" (click)="getId(team.id)">
<ion-icon name="trash"></ion-icon>
</ion-button>
</ion-col>
</ion-row>
</ion-grid>
</ion-item >
</ion-list>
<ion-card id="card-position" *ngIf="bandera">
<ion-toolbar>
<ion-button color="danger" slot="end" fill="outline"
(click)="openAndCloseModal()">X</ion-button>
</ion-toolbar>
<ion-card-content>
<ion-item>
<ion-label position="floating">Nombre Producto</ion-label>
<ion-input [(ngModel)]="team.name"></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">Precio</ion-label>
<ion-input [(ngModel)]="team.trophy"></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating">Imagen</ion-label>
<ion-input [(ngModel)]="team.image"></ion-input>
</ion-item>
<ion-button color="success" expand="full"
(click)="save()">
<span *ngIf="isUpdate">Actualizar</span>
<span *ngIf="isUpdate==false">Guardar</span>
</ion-button>
</ion-card-content>
</ion-card>
</div>
</ion-content>
Home.page.css
#container strong {
font-size: 20px;
line-height: 26px;
}
#container {
margin-right: 10px;
}
.my-custom-class .modal-wrapper {
background: #222;
}
App.componet.ts
//para crear un servicio escribimos ionic generate service api/equipo
import { Component } from '@angular/core';
import { ToastController } from '@ionic/angular';
import { AlertController } from '@ionic/angular';
import { TeamService } from '../api/team.service';
import { Team } from '../models/team';
@Component({
selector: 'app-home',
templateUrl: 'home.page.html',
styleUrls: ['home.page.scss'],
})
export class HomePage {
id = ''
bandera = false
isUpdate = false
team:Team = {name:'', trophy:'', image:''}
ListTeam:Team[]
constructor(private teamService:TeamService,
public toastController: ToastController,
public alertController: AlertController){
this.loadTeam();
}
public openAndCloseModal():void{
this.bandera = !this.bandera
this.isUpdate = false
this.clearInput()
}
public loadTeam():void{
this.teamService.getTeams().subscribe(
(response) => {
this.ListTeam = response
},
(error) => { console.log(error) })
}
public save():void{
if(this.isUpdate){
this.teamService.updateTeam(this.team).subscribe(
(response) => {
this.presentToast(response)
this.clearInput()
this.loadTeam()
this.isUpdate = false
},
(error) => { console.log(error) })
}else{
this.teamService.addTeam(this.team).subscribe(
(response) => {
this.presentToast(response)
this.clearInput()
this.loadTeam()
},
(error) => { console.log(error) })
}
}
public delete():void{
this.teamService.deleteTeam(this.id).subscribe(
(response) => {
this.presentToast(response)
this.loadTeam()
},
(error) => { console.log(error) })
}
public getId(id:string):void{
this.id = id
this.presentAlertConfirm()
}
public getTeam(id:string):void{
this.teamService.getTeam(id).subscribe(
(response) => {
const {id, name, trophy, image} = response
this.team.id = id
this.team.name = name
this.team.trophy = trophy
this.team.image = image
this.isUpdate = true
this.bandera = true
},
(error) => { console.log(error) })
}
public clearInput():void{
this.team.name = '';
this.team.trophy = '';
this.team.image = '';
}
async presentAlertConfirm() {
const alert = await this.alertController.create({
cssClass: 'my-custom-class',
header: 'Confirm!',
message: '<strong>Desea Eliminar</strong>!!!',
buttons: [
{
text: 'Cancel',
role: 'cancel',
cssClass: 'danger',
handler: () => {
return false;
}
}, {
text: 'Okay',
handler: () => {
this.delete()
}
}
]
});
await alert.present();
}
async presentToast(message) {
const toast = await this.toastController.create({
message:message.msg ,
duration: 2000,
color:"primary"
});
toast.present();
}
}

Weitere ähnliche Inhalte

Was ist angesagt?

What Have The Properties Ever Done For Us
What Have The Properties Ever Done For UsWhat Have The Properties Ever Done For Us
What Have The Properties Ever Done For UsMiklós Martin
 
Python avanzado - parte 1
Python avanzado - parte 1Python avanzado - parte 1
Python avanzado - parte 1coto
 
Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Pythonpugpe
 
밑바닥부터 시작하는 의료 AI
밑바닥부터 시작하는 의료 AI밑바닥부터 시작하는 의료 AI
밑바닥부터 시작하는 의료 AINAVER Engineering
 
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzingGareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzingYury Chemerkin
 
Extending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::UtilExtending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::UtilNova Patch
 
2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット
2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット
2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリットRyo Nagaoka
 
The Ring programming language version 1.2 book - Part 39 of 84
The Ring programming language version 1.2 book - Part 39 of 84The Ring programming language version 1.2 book - Part 39 of 84
The Ring programming language version 1.2 book - Part 39 of 84Mahmoud Samir Fayed
 
Mocks, Spies, and Timers - Oh My!
Mocks, Spies, and Timers - Oh My!Mocks, Spies, and Timers - Oh My!
Mocks, Spies, and Timers - Oh My!Lisa Backer
 
PyCon Siberia 2016. Не доверяйте тестам!
PyCon Siberia 2016. Не доверяйте тестам!PyCon Siberia 2016. Не доверяйте тестам!
PyCon Siberia 2016. Не доверяйте тестам!Ivan Tsyganov
 
The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185Mahmoud Samir Fayed
 
Learn JavaScript HTML & CSS
Learn JavaScript HTML & CSSLearn JavaScript HTML & CSS
Learn JavaScript HTML & CSSBilal Mirza
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2Kevin Chun-Hsien Hsu
 
Scala meetup
Scala meetupScala meetup
Scala meetup扬 明
 

Was ist angesagt? (19)

What Have The Properties Ever Done For Us
What Have The Properties Ever Done For UsWhat Have The Properties Ever Done For Us
What Have The Properties Ever Done For Us
 
Ruby things
Ruby thingsRuby things
Ruby things
 
Python avanzado - parte 1
Python avanzado - parte 1Python avanzado - parte 1
Python avanzado - parte 1
 
Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Python
 
밑바닥부터 시작하는 의료 AI
밑바닥부터 시작하는 의료 AI밑바닥부터 시작하는 의료 AI
밑바닥부터 시작하는 의료 AI
 
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzingGareth hayes. non alphanumeric javascript-php and shared fuzzing
Gareth hayes. non alphanumeric javascript-php and shared fuzzing
 
Extending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::UtilExtending Operators in Perl with Operator::Util
Extending Operators in Perl with Operator::Util
 
2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット
2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット
2017-08-22 Python×Djangoで作るHR Techサービスのメリット・デメリット
 
The Ring programming language version 1.2 book - Part 39 of 84
The Ring programming language version 1.2 book - Part 39 of 84The Ring programming language version 1.2 book - Part 39 of 84
The Ring programming language version 1.2 book - Part 39 of 84
 
Mocks, Spies, and Timers - Oh My!
Mocks, Spies, and Timers - Oh My!Mocks, Spies, and Timers - Oh My!
Mocks, Spies, and Timers - Oh My!
 
PureScript & Pux
PureScript & PuxPureScript & Pux
PureScript & Pux
 
PyCon Siberia 2016. Не доверяйте тестам!
PyCon Siberia 2016. Не доверяйте тестам!PyCon Siberia 2016. Не доверяйте тестам!
PyCon Siberia 2016. Не доверяйте тестам!
 
The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185The Ring programming language version 1.5.4 book - Part 42 of 185
The Ring programming language version 1.5.4 book - Part 42 of 185
 
Learn JavaScript HTML & CSS
Learn JavaScript HTML & CSSLearn JavaScript HTML & CSS
Learn JavaScript HTML & CSS
 
Corona sdk
Corona sdkCorona sdk
Corona sdk
 
[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2[1062BPY12001] Data analysis with R / week 2
[1062BPY12001] Data analysis with R / week 2
 
Python bokeh cheat_sheet
Python bokeh cheat_sheet Python bokeh cheat_sheet
Python bokeh cheat_sheet
 
Scala meetup
Scala meetupScala meetup
Scala meetup
 
Promise
PromisePromise
Promise
 

Ähnlich wie Team pdf ionic

Creating a Facebook Clone - Part VI - Transcript.pdf
Creating a Facebook Clone - Part VI - Transcript.pdfCreating a Facebook Clone - Part VI - Transcript.pdf
Creating a Facebook Clone - Part VI - Transcript.pdfShaiAlmog1
 
Creating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdfCreating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdfShaiAlmog1
 
Creating a Facebook Clone - Part XI.pdf
Creating a Facebook Clone - Part XI.pdfCreating a Facebook Clone - Part XI.pdf
Creating a Facebook Clone - Part XI.pdfShaiAlmog1
 
Creating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdfCreating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdfShaiAlmog1
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docxajoy21
 
Creating a Facebook Clone - Part VI.pdf
Creating a Facebook Clone - Part VI.pdfCreating a Facebook Clone - Part VI.pdf
Creating a Facebook Clone - Part VI.pdfShaiAlmog1
 
Initial UI Mockup - Part 3.pdf
Initial UI Mockup - Part 3.pdfInitial UI Mockup - Part 3.pdf
Initial UI Mockup - Part 3.pdfShaiAlmog1
 
카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angular카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angularif kakao
 
ES6 patterns in the wild
ES6 patterns in the wildES6 patterns in the wild
ES6 patterns in the wildJoe Morgan
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"GeeksLab Odessa
 
Martin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick ReferenceMartin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick ReferenceSeung-Bum Lee
 
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdfAdapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdfShaiAlmog1
 
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv Startup Club
 
Un-Framework - Delivering Dynamic Experiences with HTML over the Wire
Un-Framework - Delivering Dynamic Experiences with HTML over the WireUn-Framework - Delivering Dynamic Experiences with HTML over the Wire
Un-Framework - Delivering Dynamic Experiences with HTML over the WireAndreas Nedbal
 
Creating a Facebook Clone - Part XI - Transcript.pdf
Creating a Facebook Clone - Part XI - Transcript.pdfCreating a Facebook Clone - Part XI - Transcript.pdf
Creating a Facebook Clone - Part XI - Transcript.pdfShaiAlmog1
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingDevnology
 
Vue-3-Cheat-Sheet.pdf
Vue-3-Cheat-Sheet.pdfVue-3-Cheat-Sheet.pdf
Vue-3-Cheat-Sheet.pdfLarsHunze1
 
Creating an Uber Clone - Part XXXIX.pdf
Creating an Uber Clone - Part XXXIX.pdfCreating an Uber Clone - Part XXXIX.pdf
Creating an Uber Clone - Part XXXIX.pdfShaiAlmog1
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcionalNSCoder Mexico
 
Creating an Uber Clone - Part XXIV.pdf
Creating an Uber Clone - Part XXIV.pdfCreating an Uber Clone - Part XXIV.pdf
Creating an Uber Clone - Part XXIV.pdfShaiAlmog1
 

Ähnlich wie Team pdf ionic (20)

Creating a Facebook Clone - Part VI - Transcript.pdf
Creating a Facebook Clone - Part VI - Transcript.pdfCreating a Facebook Clone - Part VI - Transcript.pdf
Creating a Facebook Clone - Part VI - Transcript.pdf
 
Creating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdfCreating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdf
 
Creating a Facebook Clone - Part XI.pdf
Creating a Facebook Clone - Part XI.pdfCreating a Facebook Clone - Part XI.pdf
Creating a Facebook Clone - Part XI.pdf
 
Creating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdfCreating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdf
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
Creating a Facebook Clone - Part VI.pdf
Creating a Facebook Clone - Part VI.pdfCreating a Facebook Clone - Part VI.pdf
Creating a Facebook Clone - Part VI.pdf
 
Initial UI Mockup - Part 3.pdf
Initial UI Mockup - Part 3.pdfInitial UI Mockup - Part 3.pdf
Initial UI Mockup - Part 3.pdf
 
카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angular카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angular
 
ES6 patterns in the wild
ES6 patterns in the wildES6 patterns in the wild
ES6 patterns in the wild
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
Martin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick ReferenceMartin Fowler's Refactoring Techniques Quick Reference
Martin Fowler's Refactoring Techniques Quick Reference
 
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdfAdapting to Tablets and Desktops - Part 3 - Transcript.pdf
Adapting to Tablets and Desktops - Part 3 - Transcript.pdf
 
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
 
Un-Framework - Delivering Dynamic Experiences with HTML over the Wire
Un-Framework - Delivering Dynamic Experiences with HTML over the WireUn-Framework - Delivering Dynamic Experiences with HTML over the Wire
Un-Framework - Delivering Dynamic Experiences with HTML over the Wire
 
Creating a Facebook Clone - Part XI - Transcript.pdf
Creating a Facebook Clone - Part XI - Transcript.pdfCreating a Facebook Clone - Part XI - Transcript.pdf
Creating a Facebook Clone - Part XI - Transcript.pdf
 
mobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkelingmobl: Een DSL voor mobiele applicatieontwikkeling
mobl: Een DSL voor mobiele applicatieontwikkeling
 
Vue-3-Cheat-Sheet.pdf
Vue-3-Cheat-Sheet.pdfVue-3-Cheat-Sheet.pdf
Vue-3-Cheat-Sheet.pdf
 
Creating an Uber Clone - Part XXXIX.pdf
Creating an Uber Clone - Part XXXIX.pdfCreating an Uber Clone - Part XXXIX.pdf
Creating an Uber Clone - Part XXXIX.pdf
 
Intro programacion funcional
Intro programacion funcionalIntro programacion funcional
Intro programacion funcional
 
Creating an Uber Clone - Part XXIV.pdf
Creating an Uber Clone - Part XXIV.pdfCreating an Uber Clone - Part XXIV.pdf
Creating an Uber Clone - Part XXIV.pdf
 

Kürzlich hochgeladen

NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Servicemeghakumariji156
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptNANDHAKUMARA10
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilVinayVitekari
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network DevicesChandrakantDivate1
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaOmar Fathy
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 

Kürzlich hochgeladen (20)

Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 

Team pdf ionic

  • 1. Team.services public addTeam(team:Team){ const formData = new FormData() formData.append("name", team.name) formData.append("trophy", team.trophy) formData.append("image", team.image) return this.http.post(this.url, formData) } public deleteTeam(id:string){ return this.http.delete(this.url+'?id='+id) } public getTeam(id:string){ return this.http.get<Team>(this.url+'?id='+id) } public updateTeam(team:Team){ return this.http.put(this.url, team) } } Home.page.html <ion-header [translucent]="true"> <ion-toolbar color="tertiary"> <ion-title>Productos</ion-title> <ion-buttons slot="end"> <ion-button color="success" fill="outline" (click)="openAndCloseModal()"> Agregar Producto</ion-button> </ion-buttons> </ion-toolbar> </ion-header> <ion-content [fullscreen]="true"> <ion-header collapse="condense"> <ion-toolbar> <ion-title size="large">Football Teams</ion-title> </ion-toolbar> </ion-header> <div id="container" > <ion-list *ngIf="bandera == false">
  • 2. <ion-list-header> <ion-label>imagen</ion-label> <ion-label>producto</ion-label> <ion-label>precio</ion-label> <ion-label>opciones</ion-label> </ion-list-header> <ion-item *ngFor="let team of ListTeam"> <ion-grid> <ion-row> <ion-col> <ion-avatar> <img src={{team.image}}> </ion-avatar> </ion-col> <ion-col> <ion-label>{{team.name}}</ion-label> </ion-col> <ion-col> <ion-label>{{team.trophy}}</ion-label> </ion-col> <ion-col> <ion-button color="warning" (click)="getTeam(team.id)"> <ion-icon name="pencil"></ion-icon> </ion-button> <ion-button color="danger" (click)="getId(team.id)"> <ion-icon name="trash"></ion-icon> </ion-button> </ion-col> </ion-row> </ion-grid> </ion-item > </ion-list> <ion-card id="card-position" *ngIf="bandera"> <ion-toolbar> <ion-button color="danger" slot="end" fill="outline" (click)="openAndCloseModal()">X</ion-button> </ion-toolbar> <ion-card-content> <ion-item> <ion-label position="floating">Nombre Producto</ion-label> <ion-input [(ngModel)]="team.name"></ion-input> </ion-item> <ion-item> <ion-label position="floating">Precio</ion-label> <ion-input [(ngModel)]="team.trophy"></ion-input>
  • 3. </ion-item> <ion-item> <ion-label position="floating">Imagen</ion-label> <ion-input [(ngModel)]="team.image"></ion-input> </ion-item> <ion-button color="success" expand="full" (click)="save()"> <span *ngIf="isUpdate">Actualizar</span> <span *ngIf="isUpdate==false">Guardar</span> </ion-button> </ion-card-content> </ion-card> </div> </ion-content> Home.page.css #container strong { font-size: 20px; line-height: 26px; } #container { margin-right: 10px; } .my-custom-class .modal-wrapper { background: #222; } App.componet.ts //para crear un servicio escribimos ionic generate service api/equipo import { Component } from '@angular/core'; import { ToastController } from '@ionic/angular'; import { AlertController } from '@ionic/angular'; import { TeamService } from '../api/team.service'; import { Team } from '../models/team'; @Component({ selector: 'app-home', templateUrl: 'home.page.html', styleUrls: ['home.page.scss'],
  • 4. }) export class HomePage { id = '' bandera = false isUpdate = false team:Team = {name:'', trophy:'', image:''} ListTeam:Team[] constructor(private teamService:TeamService, public toastController: ToastController, public alertController: AlertController){ this.loadTeam(); } public openAndCloseModal():void{ this.bandera = !this.bandera this.isUpdate = false this.clearInput() } public loadTeam():void{ this.teamService.getTeams().subscribe( (response) => { this.ListTeam = response }, (error) => { console.log(error) }) } public save():void{ if(this.isUpdate){ this.teamService.updateTeam(this.team).subscribe( (response) => { this.presentToast(response) this.clearInput() this.loadTeam() this.isUpdate = false }, (error) => { console.log(error) }) }else{ this.teamService.addTeam(this.team).subscribe( (response) => { this.presentToast(response) this.clearInput() this.loadTeam() }, (error) => { console.log(error) }) }
  • 5. } public delete():void{ this.teamService.deleteTeam(this.id).subscribe( (response) => { this.presentToast(response) this.loadTeam() }, (error) => { console.log(error) }) } public getId(id:string):void{ this.id = id this.presentAlertConfirm() } public getTeam(id:string):void{ this.teamService.getTeam(id).subscribe( (response) => { const {id, name, trophy, image} = response this.team.id = id this.team.name = name this.team.trophy = trophy this.team.image = image this.isUpdate = true this.bandera = true }, (error) => { console.log(error) }) } public clearInput():void{ this.team.name = ''; this.team.trophy = ''; this.team.image = ''; } async presentAlertConfirm() { const alert = await this.alertController.create({ cssClass: 'my-custom-class', header: 'Confirm!', message: '<strong>Desea Eliminar</strong>!!!', buttons: [ { text: 'Cancel', role: 'cancel', cssClass: 'danger', handler: () => { return false;
  • 6. } }, { text: 'Okay', handler: () => { this.delete() } } ] }); await alert.present(); } async presentToast(message) { const toast = await this.toastController.create({ message:message.msg , duration: 2000, color:"primary" }); toast.present(); } }