Store 'form' in a variable - Meteor

1

I'm trying to store an entry by telcado or input in a variable, but when I try to print it, it returns empty.

This is a simple login.

I have a file called login.js, in which the one I set the from in the following way:

Template.login.events({
'submit form': function(event) {
    event.preventDefault();
    Meteor.loginWithPassword(**aux =** event.target.usuario.value, event.target.clave.value, function(err){

Regarding the html file, the code that it presents is the following:

div class="modal-body">
      <form class="form col-md-12 center-block">
        <div class="form-group">
         <input name="usuario" type="text" id="inputEmail" class="form-control input-lg" placeholder="Usuario" required autofocus>
        </div>
        <div class="form-group">
         <input name="clave" type="password" id="inputPassword" class="form-control input-lg" placeholder="Contraseña" required>
        </div>
        <div class="form-group">
         <button class="btn btn-lg btn-primary btn-block" type="submit">Ingresar</button>
         <br>
         <!--Es posible que sea necesario,destinar un link, para ayudar al usuario en el caso de que no pueda acceder-->
         <span><a id="ayuda" href="#">¿Necesitas ayuda?</a></span>
        </div>
      </form>
  </div>

When trying to print the value of said variable from another template ( {{aux}} ), through the html file, it does not print any value. The value I try to store and print in another template is the name of the user,

I have tried this process importing and exporting the variable in several ways, but I never get to print the value. The truth, I'm not sure how to do it (I'm new to web programming, and Meteor)

    
asked by Mario López Batres 19.01.2017 в 15:43
source

1 answer

3
 Template.tutemplate.helpers({
 currentUser: function() {
  return Meteor.userId();
 }
})
    
answered by 19.01.2017 / 17:31
source