Copied to clipboard

Flag this post as spam?

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


  • Luke 110 posts 256 karma points
    May 06, 2015 @ 11:14
    Luke
    0

    Get Property By Alias In Property Editor

    Hello,

    I have a custom property editor - does anyone know how I can get the value of another property from within the angular controller by the property alias.

    For example I have the start of my function:

    angular.module("umbraco")
        .controller("My.Controller",
        function ($scope, editorState) {
    

    I tried editorState.current.getPropertyValue(myAlias) but did not work. Any help would be greatly appreciated.

    Regards L

  • Luke 110 posts 256 karma points
    May 07, 2015 @ 10:53
    Luke
    0

    Sorry to ask but does anybody have any idea on this one?

    I am in desperate need of finding a solution.

    Thanks and Regards, L

  • Marcin Zajkowski 112 posts 585 karma points MVP 7x c-trib
    Dec 02, 2015 @ 14:51
    Marcin Zajkowski
    1

    Hello,

    I created simple helper function for handling it. It is using underscore to filter and retrieve proper value for desired property by alias.

    $scope.getPropertyValueByAlias = function (myAlias) {
    
        return _.findWhere(_.filter(editorState.current.tabs, function(tab) {
            return _.some(tab.properties, { alias: myAlias }); 
        })[0].properties, { 
            alias: myAlias // It could be any else property you want
        }).value;
    
    };
    

    Hope that it will be helpful for anyone else. Helped for me :)

Please Sign in or register to post replies

Write your reply to:

Draft