ng-submit不会触发事件

问题描述 投票:0回答:1

我对这种简单的表单提交感到困惑。我觉得一切都正确,但没有用。

我的[[html:

<html ng-app = 'myApp'> <div ng-controller="Tabs"> ... <form ng-submit="sendClicked()" > <div class="input-group"> <input type="text" class="form-control" ng-model="text"/> <span class="input-group-btn" > <button class="btn btn-info" type="submit">SEND</button> </span> </div> </form> ... </div> </html>
我的[[app.js

myApp.controller('Tabs', function ($scope) { $scope.sendClicked = function () { console.log('can reach here'); if($scope.text) { socket.emit('send message', $scope.text); $scope.text = null; } }; });

javascript angularjs forms onclicklistener ng-submit
1个回答
1
投票
输入输入类型
© www.soinside.com 2019 - 2024. All rights reserved.