Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Laurent Lequenne 122 posts 247 karma points
    Sep 04, 2017 @ 10:09
    Laurent Lequenne
    0

    Extending angular module

    Hi,

    I would like to extend the dateTimePickerController which is implemented in the umbracoControllers. It's only about adding two lines of code to be able to hide the date picker in certain cases.

    Actually I just created a plugin which will overwrite that controller with the current source code of the dateTimePickerController and those additionals lines... Which are in the body of the function :

    function dateTimePickerController($scope, notificationsService, assetsService, angularHelper, userService, $element, dateHelper) 
    {
    
         // Original  Config initialization 
         // ....
         if ($scope.model.config.format == "HH:mm:ss")
         {
             config.pickDate = false;
             config.pickTime = true;
         }
    
         // ....
         // Rest of the code
    } 
    

    is there any way to extend the original function dateTimePickerController by just adding that piece of code ?

  • Tobias Klika 101 posts 570 karma points c-trib
    Sep 04, 2017 @ 14:48
    Tobias Klika
    0

    I wouldn't modify the built-in editor, as they get changed over releases.

    If you really really want to do so, you could just alter the source code of the propertyeditor. ... hides and runs away ...

    What I do suggest is to create a new property editor based on this one.

    You need the template and the controller code (here) for your new editor (and add your additional lines). And this tutorial is how you create an editor.

    I do not think there's a way to just say "go to this controller and inject this code at line xy". Correct me if I am wrong.

    So, just create a custom editor ;-)

Please Sign in or register to post replies

Write your reply to:

Draft