当从聚焦输入按下回车键时,ng-submit不起作用

时间:2015-06-18 22:28:30

标签: javascript angularjs

出于某种原因,当我在取消隐藏输入后按Enter键时,submit_form()函数无法运行。有没有人对为什么这不起作用有任何想法?

<form name="theform" ng-submit="submit_form()" novalidate>

        <div ng-hide="show_form">
            <div ng-click="show_input()">Click me</div>
        </div>

        <div ng-show="show_form">
            <input type="text" class="md_input" ng-model="inputstuff" placeholder="name" required />   
        </div>

</form>

内部控制器:

$scope.show_form = false;
$scope.show_input = function() { $scope.show_form = true; }
$scope.submit_form = function() { console.log("TRIGGER"); }

0 个答案:

没有答案