Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

I am trying to create a button and on that button I have created a popup with angularjs. When I am using normal html tag it is opening the popup properly .But When I am converting in rails tag the popup gets dissapear within 1 sec and automatically the pages gets redirected to some other page .I have never use angularJs..Any solution will be helpful

  <button type="button" class="btn btn-primary btn-lg" ng-click="deviceregisteration($event)">Add New Device</button> 


So my this rails code is creating problem as I have mention above

<%= f.submit 'Add New Device',:class =>'btn btn-primary btn-lg'  ,'ng-click'=>"deviceregisteration($event)" %>
share|improve this question
up vote 0 down vote accepted

The reason that your button made the popup disappeared is that it submitted the form.

Your plain HTML way, that button is simply a button, nothing more, so when you hit that button, it triggered the event.

When you used rails code, that button is a submit button, when you click on, it triggered the event and also submit the form and redirect to another page due to the response.

To fix this, you can just use f.button instead of f.submit.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.