Copied to clipboard

Flag this post as spam?

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


  • Kenneth Solberg 227 posts 418 karma points
    Jan 11, 2016 @ 09:30
    Kenneth Solberg
    0

    Get value back from umb-editor

    Hi, I'm trying to reuse the umb-editor directive with datepicker view:

    controller:

    $scope.myvalue = {}; 
    
    $scope.datepickerModel = {
      alias: 'mydatepicker',
      view: 'datepicker',
      value: $scope.myvalue,
      config: {
        pickDate: true,
        pickTime: false
      }
    };
    
    $scope.$watch('myvalue', function() {
      console.log('** date selected **');
    }
    

    view:

    <umb-editor model="datepickerModel"></umb-editor>
    

    The editor appears with correct config, but the watch does not trigger when I select a date. What am I missing?

  • Kenneth Solberg 227 posts 418 karma points
    Jan 11, 2016 @ 10:25
    Kenneth Solberg
    2

    After some digging I noticed that model.value was not updated in the applyDate in Umbraco.PropertyEditors.DatepickerController. However, in this dev branch commit it does! Happy times :-)

    https://github.com/umbraco/Umbraco-CMS/commit/dbece874dd7d1ffbe124c4f6f8e18a11a290fe32

    After adding this line to my umbraco\js\umbraco.controllers.js, the changed model.value was not reflected in my view, but at least now I can get it like this:

    $scope.datepickerModel = {
        view: 'datepicker',
        value: $scope.mydatepickervalue,
        config: {
            pickDate: true,
            pickTime: true
        }
    };
    
    $scope.$watch('datepickerModel.value', function (newValue) {
        $scope.myvalue = newValue;
    });
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies