AngularJS: Call the ng-submit event outside the form

前端 未结 10 1475
渐次进展
渐次进展 2020-12-09 02:07

I\'m a fish in AngularJS and I have this scenario.

10条回答
  •  天命终不由人
    2020-12-09 02:30

    Use HTML5's form attribute, here's a sample:

    angular.module('app', [])
    
    .controller('MyCtrl', ['$scope', function($scope) {
      $scope.submitted = false;
      
      $scope.confirm = function() {
        $scope.submitted = true;
      };
    }]);
    form {
      padding:5px;
      border: 1px solid black
    }
    
    
    
    
      
      JS Bin
    
    
      
      

    The form was submitted

提交回复
热议问题