Datepicker month content with function AngularsJS

3 posts, 0 answers
  1. Jhony
    Jhony avatar
    5 posts
    Member since:
    May 2016

    Posted 22 Nov 2016 Link to this post

    I am creating a datepicker range directive and would like to change the style in the range between the dates it contains in my model, for example between the date model.startDate and model.endDate I want to put a gray background, for this I am using the

    month: {

        content: '<div class = \' # = isBetweenDates(data)? "k-state-hover": "" # \ '> # = data.value # </ div>';

    }.

    My problem is the function .. it only fills my function when I create in the global object .. window.isBetweenDates = function (data) {....

    In this case, if I use two directives .. the second will overlap the first one because it will overwrite the method, since it is in the global scope ..

    Is there any way I can link that function with each scope  directive that was created, so as not to impact each other? If there is more than one

    I tried to make some forms, for example use $ compile and move to content but I can only pass string.

     

    Thank You!! 

  2. Jhony
    Jhony avatar
    5 posts
    Member since:
    May 2016

    Posted 22 Nov 2016 Link to this post

    I'm sending you an image to understand better.

    In this case it works!!

    But if i have more than one datepicker directive, doesn't work! only the last directive created because he overwrite the method.

  3. Stefan
    Admin
    Stefan avatar
    588 posts

    Posted 24 Nov 2016 Link to this post

    Hello Jhony,

    I can confirm that this is indeed a limitation when using a function in the template of the month.content property of the DatePicker.

    In this scenario, I can suggest using different templates with different functions for the DatePicker directives. I understand that this is not the best solution, but in the current implementation of the DatePicker, it is the needed.

    Apologies for the inconvenience this may cause you

    Regards,
    Stefan
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Back to Top