winmarkltd / BootstrapFormHelpers

Bootstrap Form Helpers
https://bootstrapformhelpers.com
1.15k stars 374 forks source link

Add angular support #162

Open danarmstrong opened 10 years ago

danarmstrong commented 10 years ago

After all of my attempts at creating angular directives, I simply cannot get formhelpers to work properly due to a couple of different factors. I will gladly purchase commercial licenses to support future development if angular support is added.

vlamanna commented 10 years ago

Hi,

Can you add your current code in a jsfiddle and share with me? Also, you might want to look at this project: http://mgcrea.github.io/angular-strap/

danarmstrong commented 10 years ago

Here is a bare minimum example using the timepicker and datepicker. The selectbox goes a little deeper because I'm loading the options from an endpoint and the promises don't return until after the selectbox is created

http://jsfiddle.net/dan_armstrong/q88Fm/6/

After much playing around I managed to get two of the components working but the code is very ugly and the data-binding needs some work.

For the combo boxes though, it would be helpful to have a method to update the entire component or at least add options on the fly. Angular has very nice select directives built in but I'm not hopeful that they would ever work with your library.

danarmstrong commented 10 years ago

Upon further review, it seems that the timepicker is still having a few issues. Sometimes the numbers between the selector and the input get out of sync. You can see this by

  1. Open the time picker
  2. Click the up arrow for hour a couple of times
  3. Click the down arrow and the input doesn't update
  4. Click the down arrow again and both update but do not display the same value

UPDATE: It appears that this doesn't happen in jsfiddle, but does happen in my angular application.

danarmstrong commented 10 years ago

Looking at the timepicker code, I can see why I'm experiencing this. You are triggering the event before updating the value in nextHour(), nextMinute() and previousMinute(). However, previousHour() has the event coming after the value is set. I modified the sources for the previous 3 and my application behaves as expected. Would it be possible for you to correct this in the project?