Sander,

let me try to explain. This is a sort of appointment booking so the 
available times will be different everyday. The original plnkr you posted 
say for example I select a type, then a date then some hours. If I select 
the time of 03:00PM and then I go back and select a different date, the 
hours remain at 03:00PM. Not sure why this happens. 

When I go back and select a NEW date, AFTER I had already selected a date 
and time, the hours dropdown should regenerate the times based on the 
current (new date) I selected. Instead the 03:00PM option is still 
seleected. What I should see is "Choose time" which is the default text 
used when the dropdown is first loaded.

Let me show u the jquery code I was using for this

function forceDropDownDependency() {

    $('select[name="appointment_
type"]').change(function() { $('#appointment_date').show(); });
    $('select[name="appointment_date"]').change(function() {

        $('#appointment_hours').show();

        var date = $('select[name="appointment_date"]').val();

        $.ajax({
            url: 'scripts/display_barber_hours',
            type: 'POST',
            dataType: 'html',
            data: {
                "date" : date
            },

*            success: function(phpData) {                
$('select[name="appointment_**hours"]').empty().append(*
*phpData); *

*                return false;            }*,
            error: function(req, status, error) {
                alert("Oops! Status: " + req.status + ", Response: " + 
req.responseText + ", Error: " + error);

                return false;
            }
        });
    });

    $('select[name="appointment_hours"]').change(function() {
        $('#appointment_btn').show();
        $('#appointment_btn').prop('disabled', false);
    });
}

notice how even when making the http call to load the times, on success I 
would just replace the element that was already there with a new one with 
the new data. I can't figure out how to do this with angular without using 
jquery

let me know if you understand what I mean. Your new example sort of 
displays this, but it looks like your just grabbing different data. My 
backend returns different hours based on the date so the newValue in the 
watch statement SHOULD work but for some reason it leaves the old selected 
hours there

On Tuesday, May 13, 2014 2:49:32 AM UTC-4, Sander Elias wrote:
>
> Hi Billy,
>
> I'm not sure I can follow you, do you mean something like this: 
> http://plnkr.co/edit/7F3nlgtxT9sx2FJ4isMF?p=preview
> I updated the plunk to give a different time-table when you select the May 
> 22, 2014 date. Is that what you mean?
>
> Regards
> Sander
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to