AngularJS directive prevents a form getting submitted twice