Copied to clipboard

Flag this post as spam?

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


  • Casper Andersen 126 posts 508 karma points
    Aug 31, 2015 @ 08:15
    Casper Andersen
    0

    GetPropertyValue in Angular

    I am creating my own property editor and here i can show in a list all the items i have and send a link and so on, but on my document type i have a disabled option, i would like to grey out the text if disabled is set to true, is there a way to get hold of a property value in angular ?

  • Marc Goodson 2141 posts 14344 karma points MVP 8x c-trib
    Aug 31, 2015 @ 11:49
    Marc Goodson
    100

    Hi Casper

    It largely depends on how you are building your list of items ?

    If you are returning JSON from an API controller then add the disabled value to the returned JSON, and use it's value to set the text as disabled or not.

    Otherwise within your Angular property editor if you are using the entityResource then you will only have access to basic entity properties, eg Name, Id, etc

    http://umbraco.github.io/Belle/#/api/umbraco.resources.entityResource

    the above suggests using the contentResource instead to retrieve all properties:

    http://umbraco.github.io/Belle/#/api/umbraco.resources.contentResource

  • Casper Andersen 126 posts 508 karma points
    Sep 01, 2015 @ 11:42
    Casper Andersen
    0

    Thanks i figured it out

    i dit it like this.

    i injected the contentResource into my angular controller. Then i used this piece of code.

    contentResource.getById(item.id).then(function (content) {
        consol.log(content);
    }
    

    and to retrieve properties you can do content.propertyName

    P.S. dont use alert(JSON.Stringify(content)) since for some reason it will only return parts of the first tab use the console.log instead that also styles i nicely for you in the process

Please Sign in or register to post replies

Write your reply to:

Draft