Squrler
Squrler

Reputation: 3514

How to detect when a date is selected in Angular Bootstrap datepicker

I'm using the datepicker directive in Angular Bootstrap like so:

<datepicker ng-model="period_start" show-weeks="false" class="bs-dateselector"></datepicker>

How can I detect when a user has actually selected a date?

Upvotes: 2

Views: 2480

Answers (1)

New Dev
New Dev

Reputation: 49590

Exactly as you would detect that a user has typed into an <input ng-model="foo"> (with ng-model) - by using ng-change:

<datepicker ng-model="period_start" show-weeks="false" class="bs-dateselector"
            ng-change="dateChanged()"></datepicker>

That's the idea behind the ngModel directive - that other directives that require: "ngModel", like ng-change or various validators do not need to make any assumptions about the underlying DOM of the input control.

Upvotes: 3

Related Questions