When I click the submit button in a form it is adding a ? right before the # so /app/#/pageName changes into /app/?#/pageName. Is this normal behavior? Code is just basic st
I finally found the answer thanks to Angular JS does not allow preventDefault or return false to work on form submission.
in my ng-submit I had to add $event as parameter which passed the event to my submit function and I was then able to do event.preventDefault() to prevent the route from changing. Not sure if this is a bug in angular or if it's intended behaviour but hopefully this will help someone else.
So here is the fixed code:
angular.module('myApp', [])
.controller('MyCtrl', function ($scope) {
$scope.submit = function(event) {
event.preventDefault();
};
});
<form ng-controller="MyCtrl" ng-submit="submit($event)">
<button>Submit</button>
</form>