Commit 4e780b56 authored by Teodoro David Nina Mamani's avatar Teodoro David Nina Mamani
Browse files

Se creo la vista modal para editar persona

parent 49e1882e
...@@ -2,25 +2,20 @@ ...@@ -2,25 +2,20 @@
(()=> { (()=> {
class PersonaEditarModalController { class PersonaEditarModalController {
constructor($uibModalInstance, parametro, personaService) { constructor($uibModalInstance, parametro, personaService) {
this.persona = {};
this.alertas = []; this.alertas = [];
this.enviado = false; this.enviado = false;
this.modal = $uibModalInstance; this.modal = $uibModalInstance;
this.service = personaService; this.service = personaService;
this.personaId = parametro.personaId;
this.service.getPersona(this.personaId) this.persona = Object.assign({}, parametro.persona);
.then((persona)=>{
this.persona = persona;
console.log(persona);
})
} }
guardarPersona(form) { guardarPersona(form) {
this.enviado = true; this.enviado = true;
if (form.$valid) { if (form.$valid) {
this.service.editarPersona(this.personaId, this.persona) this.service.editarPersona(this.persona._id, this.persona)
.then((persona)=>{ .then((persona)=>{
this.modal.close(persona); this.modal.close(persona);
}) })
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
controller: 'PersonaEditarModalCtrl', controller: 'PersonaEditarModalCtrl',
controllerAs: 'vm', controllerAs: 'vm',
resolve: { resolve: {
parametro: {personaId: persona._id} parametro: {persona: persona}
} }
}).result.then(persona=> { }).result.then(persona=> {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment