gesture: Angular Material breaks form ng-submit via enter/go button on iOS
If you have a form with ng-submit, pressing enter on a iOS device (with both chrome and safari), will not trigger the ng-submit function. This works as expected with angularjs alone but with the addition of angular material, it no longer works.
Working (without ngMaterial) http://embed.plnkr.co/Cs3QTjaN6GdnfL1vOKNl/preview
Not working (with ngMaterial) http://embed.plnkr.co/F0qVeaIxNnBlLHgVKQ5Z/preview
I think I have the same issue when trying to submit a form with Angular (1.4.3) and Angular Material (0.10.1) by pressing enter: the ng-submit is not triggered, whereas it works well when there is a simple md-button inside the form
+1.. Same issue here, using angular 1.4.5, Materials 0.10.1
+1 it worked for me on 0.11.2 but broke on 1.0
+1
+1
I definitely see the issue within the Plunkr; however, when I extracted it into a simple HTML file on my own iPad to reproduce, the issue disappears. I am running iOS 9, so perhaps that is part of the difference?
Note that the Plunkr fails on Chrome on desktop as well as iOS.
Can someone double-check my code below and let me know if there is something specific you are doing to reproduce, or if it's only a particular version of iOS, because it appears to be working to me?
P.S. I've added a comment for testing against master as well to see if it was fixed, but I can't reproduce with either of them loaded.
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-material/0.10.0/angular-material.js"></script>
<!--
<script src="https://material.angularjs.org/HEAD/angular-material.min.js"></script>
//-->
</head>
<body ng-app="app">
<div ng-controller="Ctrl">
<form name="testForm" ng-submit="submit(test)">
<input type="text" ng-model="test">
<input type="submit">
</form>
</div>
<script typ="text/javascript">
angular.module('app', ['ngAnimate'])
.controller('Ctrl', function Ctrl($scope) {
$scope.submit = function(value){
alert(value)
}
})
</script>
</body>
</html>
+1 same problem here:
iOS 9.1 (13B143) on an iPhone 5 (Model A1429)
Also problem in iOS Simulator for iPhone 6, iOS 9.1 (13B137)
"angular-material": "v1.0.0-rc4"
Confirmed working in 0.11.2 but tons of other issues came up when we downgrade there.
+1 seeing same issue as @mjaverto
@mjaverto @rjdavis3 Can one of you please provide a simple HTML example like above (i.e. not a Codepen/Plunkr) that demonstrates this? As I said, I am unable to reproduce and need a little bit of help seeing exactly what code makes it break.
Thanks!
@topherfangio sure. I know this is a plunkr but just copy the HTML out easily.
http://plnkr.co/edit/miCYIujo5vwNH0PgbJOE?p=preview
I just loaded this in an iOS iPhone 6 simulator running 9.1 to confirm. I should also note, the above does work on 0.11.2.
Thanks! I can confirm and will look into it.
It doesn't appear this was fixed in a 1.0 release candidate. I'm experiencing this problem with the latest version, on Windows 10 desktop chrome version 47.0.2526.106 m.
@lewiswharf Indeed, this is still an open issue on our radar.
add type="submit" to your md-button and it worked for me
Indeed, with type="submit" and the button inside the <form> element, it works for me too
type="submit" worked! Seems logical.
adding type="submit" did not help me. iOS 9.2 AngularMaterial 11.2.
Working (with 1 input):
<form ng-submit="login()">
<md-input-container>
<label>Email</label>
<input ng-model="user.email" type="email" >
</md-input-container>
</form>
Not Working:
<form ng-submit="login()">
<md-input-container>
<label>Email</label>
<input ng-model="user.email" type="email" >
</md-input-container>
<md-input-container>
<label>Password</label>
<input ng-model="user.password" type="password">
</md-input-container>
</form>
temporary Solution:
<input ng-model="user.password" type="password" ng-keypress="keyPressed($event)">
$scope.keyPressed = function(keyEvent) {
if (keyEvent.keyCode === 13) {
cordova.plugins.Keyboard.close();
}
};
+1
+1