Ng-submit不触发事件
ng-submit doesn't fire the event
我被这个简单的表单提交卡住了。我觉得一切都是对的,但就是行不通。
My 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>
My 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;
}
};
});
必须是输入类型submit,但是你有一个按钮,它从来没有type属性属性
相关文章:
- 在表单进入Angular中的ng-submit之前验证表单
- ng-include 和 ng-submit 中丢失的范围不会提交表单,而 ng-click 会提交,但没有表单值
- ng-click 或 ng-submit 不调用控制器方法
- 角度 ng-submit 不起作用
- 使用AngularJS和ng-submit记住密码
- 在ng include之后调用ng submit
- AngularJS ng-submit无法在手风琴标签内工作
- AngularJS“ng-submit"在浏览器预填充表单字段时出现问题
- Ng-submit不触发angular-touch / touch事件
- AngularJS -函数从未被ng-submit调用过
- 使用$location.path(path)更改位置;ng-submit形式
- Ng-click和ng-submit不起作用
- Angularjs使用ng-submit或ng-click进行登录
- 使用ng-submit更新变量值
- 为什么ng-submit没有启动$scope.submit函数
- AngularJS的ng-submit输入键不起作用
- 在angularjs中,Ng-submit不触发
- Ng-submit不触发事件
- Ng-submit won't调用指令控制器内的函数
- Angularjs - form ng-submit不能与动态生成的form html一起工作