AngularJS-ResponsiveCalendar icon indicating copy to clipboard operation
AngularJS-ResponsiveCalendar copied to clipboard

Call a method on Next and Previous icon click

Open nishadotcom opened this issue 9 years ago • 9 comments

Hai @twinssbc

I like to call a method on Previous and Next icon click.

E.g:

I have a controller in body tag. Name is my_controller.

I have declared a method here.

I like to call the method while click on the Next or previous icon.

Please suggest.

Best nishadotcom

nishadotcom avatar Jan 14 '16 06:01 nishadotcom

@nishadotcom There's a rangeChanged callback you can use, please kindly check the README for the detail. Let me know if it can meet your requirement. Thanks.

twinssbc avatar Jan 15 '16 00:01 twinssbc

Hai @twinssbc

Thanks for the instruction, I wrote a separate method called Test() but I could not access it and I did not get the result.( The result would be simple alert)

Please suggest.

Best nishadotcom

nishadotcom avatar Jan 18 '16 09:01 nishadotcom

@nishadotcom could you provide your related html and js files so that I can have a look?

twinssbc avatar Jan 18 '16 12:01 twinssbc

Hai @twinssbc

Sure.

Controller angular.controller('myController', function ($scope) { $scope.get_date = function (date_param) { alert(date_param); }; });

I need to alert the date when I click on Next or Previous button by clicking.

Best nishadotcom

nishadotcom avatar Jan 18 '16 12:01 nishadotcom

@nishadotcom How do you use your get_date function in html file?

twinssbc avatar Jan 18 '16 12:01 twinssbc

Hai @twinssbc

I need to call it on ng-click.

nishadotcom avatar Jan 18 '16 13:01 nishadotcom

@nishadotcom I still don't know where do you call this get_date function. In calendar.html, the ng-click is already bound to move function, did you replace it using your get_date function? Is it possible your get_date function is defined in another scope that can't be reached to?

<div class="nav-right col-xs-2">
            <button type="button" class="btn btn-default btn-sm" ng-click="move(1)"><i
                    class="glyphicon glyphicon-chevron-right"></i></button>
</div>

twinssbc avatar Jan 18 '16 13:01 twinssbc

Hai @twinssbc

I call the method as semicolon separated

Yes, It is not reaching out. So I am getting your input.

The thing is I need to get data from service for the particular month.

Best nishadotcom

nishadotcom avatar Jan 18 '16 13:01 nishadotcom

@nishadotcom Instead of customizing the calendar internal behaviour, why not using the callback the calendar exposes?

rangeChanged
The callback function triggered when the range or mode is changed if the queryMode is set to 'remote'

$scope.rangeChanged = function (startTime, endTime) {
    Events.query({startTime: startTime, endTime: endTime}, function(events){
        $scope.eventSource=events;
    });
};

twinssbc avatar Jan 18 '16 14:01 twinssbc