Copied to clipboard

Flag this post as spam?

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


  • Hardik Mehta 12 posts 83 karma points
    Mar 22, 2018 @ 13:22
    Hardik Mehta
    0

    Reuse Member Group Picker on selection change event handler not working

    I am trying to reuse Member Group Picker of umbraco.

    but when I submit form i get $scope.myMemberGroupPicker is undefined.

    myview.html

    <div ng-controller="myContentController">
    
    <umb-control-group class="umb-membergrouppicker" label="Member Group">
                <umb-editor model="myMemberGroupPicker" prevent-default=""></umb-editor>
        </umb-control-group>
    
    </div>
    

    myview.controller.js

    function myContentController($scope, $routeParams, angularHelper) {

    $scope.myMemberGroupPicker = { view: 'memberGroupPicker', value: $scope.model.question.memberGroup, config: $.extend({}, $scope.config.memberGroupPicker) };
    
    $scope.$watch('myMemberGroupPicker', function (scope) {
            if ($scope.myMemberGroupPicker != undefined) {
                $scope.model.question.memberGroup = $scope.myMemberGroupPicker.value;
            }
        }, true);
    
    
    $scope.save = function () {
        var group = $scope.myMemberGroupPicker.value; //undefined
    }
    

    }

    angular.module("umbraco").controller("myContentController", myContentController);

Please Sign in or register to post replies

Write your reply to:

Draft