lundi 28 décembre 2020

Update model hook value after button click and taking new value from input text

Newcomer here,

async model() {

let response = await fetch('http://api.openweathermap.org/data/2.5/weather?q=London&units=metric&appid=[APIKeyPlaceholder]);

var data = await response.json();

return data;

}

I am taking this ‘data’ value and displaying it on .hbs file. Now I have added an input text field and button for entering city name. How do I update the city name and model hook value(i.e data value) with the new value I take from .hbs file ?

Do I use controller? How do I bind input to ember variable?




Aucun commentaire:

Enregistrer un commentaire