0

i have a directive for select date in my html

JSFIDDLE

angular
    .module('App',['ui.date'])
    .directive('customDatepicker',function($compile){
        return {
            replace:true,
            templateUrl:'custom-datepicker.html',
            scope: {
                ngModel: '=',
                dateOptions: '='
            },
            link: function($scope, $element, $attrs, $controller){
                var $button = $element.find('button');
                var $input = $element.find('input');
                $button.on('click',function(){
                    if($input.is(':focus')){
                        $input.trigger('blur');
                    } else {
                        $input.trigger('focus');
                    }
                });
            }    
        };
    })
    .controller('myController',function($scope){
        $scope.birthDate = '2013-07-23';
        $scope.dateOptions = {
            minDate: -20,
            maxDate: "+1M +10D"
        };
    });

Now i want to insert into this DatePicker insert time slots like this, when i select a slot i return for example $scope.time='00h-12'

I couldn't find out how to do it.

enter image description here

1 Answer 1

1

In your customDatepicker directive, you can update the datepicker directly, for example $.datepicker.dpDiv.append($("#custom-footer").contents().text());; see line 21 of the referenced jsfiddle below.

Also, following your convention, I added the custom footer text as a template embedded in a script tag; see lines 7-10.

Updated fiddle with the solution: http://jsfiddle.net/haroldcampbell/FVfSL/808/

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.