I have a Angular1 Meteor project.
In one component called login (login.js), I need to pass username and password to a meteor method on clinet side loginUser (in user.js on client). All I need is create a wrapper method for Meteor.loginWithPassword.
So in my login.html , I have login
right now the code is within constructor under helpers:
like
loginUser: function () {
// …
console.log(“inside login”);
Meteor.call(‘loginUser’, ‘myusername’,‘mypassword’);
}
Thanks @rhywden for the reply!
I thought it was best to have all user related methods in a separate file.
I am able to call Meteor.loginwithpassword from the same page and it returns ‘success’.
You are trying to call a Meteor method only on the client. But Meteor methods are always living on the server and are also optionally on the client.
Which means your call to the loginUser method went to the server and didn’t find the definition there.
Meteor methods are intended to define methods which you can’t trust the client with - such as mass insertions, deletions and so on. As such, they always have to be defined on the server.