if statement in ng-click

后端 未结 8 1036
鱼传尺愫
鱼传尺愫 2020-12-08 01:42

Is there a way to put a condition inside an ng-click? Here, I want that the form is not submitted if there are any form errors, but then I got a parse exception.

         


        
8条回答
  •  一向
    一向 (楼主)
    2020-12-08 02:11

    Don't put any Condition Expression in Template.

    Do it at the Controller.

    Template:

    
    

    Controller:

    $scope.check = function(value) {
        if (value) {
           updateMyProfile();
        }
    }
    

提交回复
热议问题