Copied to clipboard

Flag this post as spam?

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


  • Michaël Vanbrabandt 863 posts 3346 karma points c-trib
    Feb 06, 2018 @ 19:31
    Michaël Vanbrabandt
    0

    Get Property config value inside ActionView

    Hi all,

    I have a custom Menu item on the Member setup which opens a new dialog.

    Inside I have a view loaded with a controller where I need to have access to the config of my custom property which is a content picker on my member type: $scope.model.config.myPropertyAlias.

    When I lookup this value using the console I see, when I click on a member, the correct value of my property config, eg the Id of the selected content node.

    But when I click on the Action menu item I get an error in the console: TypeError: Cannot read property 'config' of undefined

    My view:

    <div ng-controller="MyCustomController as vm" class="umb-dialog umb-pane">
    
        <div class="umb-dialog-body">
    
            <p>My selected page in the datatype config: {{vm.node}}</p>
    
            <div class="umb-pane btn-toolbar umb-btn-toolbar">
                <div class="control-group umb-control-group">
                    <a href ng-click="nav.hideMenu()" class="btn btn-link">Cancel</a>
                </div>
            </div>
    
        </div>
    
    </div>
    

    My controller:

    (function () {
    
        'use strict';
    
        function myCustomController(
            $scope,
            $http,
            editorState,
            contentResource) {
    
            var vm = this;
    
            // Set the member name
            vm.memberName = editorState.current.name;
    
            // Get the page
            vm.node = $scope.model.config.memberRedirectPage;
    
        }
    
        angular.module('umbraco')
            .controller('MyCustomController', myCustomController);
    
    })();
    

    /Michaël

Please Sign in or register to post replies

Write your reply to:

Draft