In Jade, how can I suppress the error if a variable does not exist?

4

I'm trying to create a form to create a user, but I use the same form to edit. When I try to create a new user the app shows me an error because in the form fields it tries to get information from a user that obviously does not exist because I am creating and not editing information.

In PHP we use @$user->name to suppress errors, but how to do this with jade?

input.form-control(name='name',value=user.name)
    
asked by anonymous 20.08.2015 / 16:53

1 answer

1
- if (typeof(user.name) !== 'undefined'){
  //-aqui você coloca o seu código
-}

I think this will solve.

    
29.09.2015 / 18:10