Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'parroquia' of undefined with VUE.js #35

Open
edward4578 opened this issue Jan 13, 2018 · 1 comment
Open

Comments

@edward4578
Copy link

edward4578 commented Jan 13, 2018

All render well until it reaches the object of the json parish .. I do not understand why it does not?
Because when I run the console.log brings me the correct data here I leave part of the code if anyone can help me .. Thank you very much

JSON:

{
"id": 1,
"cedula": "14748547",
"nombres": "Pepito",
"apellidos": "¨Pregunton",
"email": "[email protected]",
"telefono": "02128477447",
"direccion": "La Palomera",
"parroquia_id": 617,
"parroquia": {
"id": 617,
"parroquia": "BARUTA",
"municipio_id": 181,
"municipio": {
"id": 181,
"municipio": "BARUTA",
"estado_id": 13,
"estado": {
"id": 13,
"estado": "MIRANDA",
"activo": 0
}
}
},
"canaimas": [
{
"id": 1,
"modelo": "MG10T",
"deleted_at": null,
"activo": 1,
"pivot": {
"beneficiario_id": 1,
"canaima_id": 1,
"serial_canaima": "454DS5FDFD55",
"descripcion": "esta rayada"
}
},
{
"id": 6,
"modelo": "Canaima Docente VIT D2100",
"deleted_at": null,
"activo": 1,
"pivot": {
"beneficiario_id": 1,
"canaima_id": 6,
"serial_canaima": "kjdfbksjhgr43",
"descripcion": "NINGUNA"
}
}
]
}

html

×

Detalles

Cédula Nombres Apellidos Email Teléfono
Direccion <textarea v-model="beneficiario.direccion" class="form-control" readonly="readonly" name="direccion"></textarea> Estado Municipio Parroquia
# Modelo Serial Descripción
@{{item.id}} @{{item.modelo}} @{{item.pivot.serial_canaima}} @{{item.pivot.descripcion}}

vue.js

<script type="text/javascript"> new Vue({ el: '#beneficiario', created: function () { //this.showBeneficiario(); }, data: { beneficiario: [], errors: [], }, methods: { showBeneficiario: function (id) { var url = 'beneficiario/'+ id; axios.get(url).then(response => { this.beneficiario = response.data; $('#show').modal('show'); console.log(response.data.parroquia.parroquia); console.log(response.data.parroquia.municipio.municipio); console.log(response.data.parroquia.municipio.estado.estado); }); } } });</script>
@nigeldeakin
Copy link
Contributor

It's not clear what connection your issue has with the Fn UI. Can you provide more information?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants