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

前端 未结 8 934
暖寄归人
暖寄归人 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:10

    To be callable from the view, a function must be in the $scope. Add

    $scope.login = login;
    

    to the JS code of the controller.

    You also need to actually use that controller. Change

    to

    This is all fundamental stuff. My advice would be to learn from an AngularJS tutorial before going further.

提交回复
热议问题