AngularJS error: TypeError: v2.login is not a function

前端 未结 8 928
暖寄归人
暖寄归人 2021-01-17 07:49

I would like to call the login function when I click the login button but keep getting the error message in the title. Can someone point out the error in my script?

8条回答
  •  醉梦人生
    2021-01-17 08:15

    In AngularJS call the function from view it must be in the $scope.

    JS

    // exposes login function in scope
    $scope.login = login;
    

    HTML

提交回复
热议问题