Accessing parent attributes in MVVM

4 posts, 1 answers
  1. Grant
    Grant avatar
    179 posts
    Member since:
    Jul 2016

    Posted 22 Mar 2018 Link to this post


    In short I want to know how to access the value of a parent's sibling attribute in the MVVM observable object. I do have a solution but I would like to know if the best option for me to use.


  2. Answer
    Konstantin Dikov
    Konstantin Dikov avatar
    2466 posts

    Posted 26 Mar 2018 Link to this post

    Hi Grant,

    Using the ViewModel is the correct way of accessing an object in this scenario. Note that you could get reference to the object directly:

    Best Regards,
    Konstantin Dikov
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Grant
    Grant avatar
    179 posts
    Member since:
    Jul 2016

    Posted 26 Mar 2018 in reply to Konstantin Dikov Link to this post

    Morning Konstantin, 

    Thanks for the confirmation, although I'd rather avoid using a direct reference so as to no loose any dependency links.


    Thanks so much,

  4. David
    David avatar
    12 posts
    Member since:
    May 2013

    Posted 10 May 2018 Link to this post

    You could also traverse up the tree as well.


    Or can you tell me why this would be a bad idea? then you wouldn't have to reference the viewmodel by name directly. As you know where you are in the object it's just a case of going up the levels to come back down. 

Back to Top