Uncaught TypeError: Cannot call method 'put' of undefined

Tags: angularjs
By : Junhao
Source: Stackoverflow.com
Question!

i am facing this issue when i am trying to store data in my angular controller page using the $cookieStore. Are there any additional configurations that i have left out?

function fbLogin($cookieStore){

    $cookieStore.put("userid",'12345');
    validateUser(userid);
    alert(userid);
}
By : Junhao


Answers

You're not actually defining userId anywhere to JavaScript. You're setting a cookie whose value is userid=12345, but then calling validateUser with an unknown variable, userId which has the undefined value.



This video can help you solving your question :)
By: admin