I'm working in a lightning app example and i can´t get the value of an input from the controller.
When I try to get the value and insert it into a the program throws an error when calling controller.find()--->UNDEFINED. Here is the code: Component
<aura:component>
<aura:attribute name="idCocheOut" type="Integer" />
<aura:attribute name="nombreOut" type="String" />
<div class="c-container">
<lightning:input type="number" aura:id="idCoche" label="Identificador Coche" />
<lightning:input type="text" aura:id="nombre" label="Nombre Coche" />
<lightning:button label="Introducir coche" onclick="{!c.crearCoche}"/>
<br/>
<br/>
</div>
</aura:component>
Controller
({
crearCoche : function(component, event) {
var nombre = component.find('nombre').getElement().value;
var id = component.find('idCoche').getElement().value;
component.set("v.nombreOut",nombre);
component.set("v.idCocheOut",id);
}
})
Thanks!