I'm new to angular and I'm using angular-bootstrap-datetimepicker, and I want to access its directive attribute data-datetimepicker-config in my controller
<datetimepicker data-ng-model="data.date" data-datetimepicker-config="{ dropdownSelector: '.dropdown-toggle' }"></datetimepicker>
I have a select component which contains values like daily monthly and yearly and I want to change the minView value of my datetimepicker with the select value.
How can I do that ?
The documentation states that
you can pass configuration options as a function or an object.
So you should simply define the config object in your scope or controller and then pass it as value of the data-datetimepicker-config attribute. Here's how you could go about it:
$scope.pickerConfig = { dropdownSelector: '.dropdown-toggle' };
Then in your view:
<datetimepicker data-ng-model="data.date" data-datetimepicker-config="pickerConfig"></datetimepicker>
Basically, changes in pickerConfig will be applied to datetimepicker directive. It is as simple as that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With