Load data to input

hi everybody … i am unable to load data to an input …
if you run this code … if joe is empty ( =="" ) this code will give you an error… but if joe is not empty it will run fine… please need help

<input value={{name}}>

<script>
data: function () {
var name = "joe";
return {
 name : name 
}
}
</script>

how to load properly data to an input field ?

The fact that it will run fine when the value is not null suggests you don’t have a problem with loading data to an input.

The issue here is properly checking your data before it gets passed to the function, so you can be set up for a situation where the data might be null. You should have code that responds to that situation.

If all else fails, use a try/catch block to handle errors.

Ok i ll try it. Thanks for the anwser