Accessing parent attributes in MVVM

3 posts, 1 answers
  1. Grant
    Grant avatar
    100 posts
    Member since:
    Jul 2016

    Posted 22 Mar Link to this post

    Hi, 

    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.

    http://dojo.telerik.com/AZEZixAs

    Thanks,
    Grant

  2. Answer
    Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2212 posts

    Posted 26 Mar 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:
    viewModel.person.name


    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
    100 posts
    Member since:
    Jul 2016

    Posted 26 Mar 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.

    See
    https://www.telerik.com/forums/viewmodel-attr-vs-viewmodel-get('attr')
    https://docs.telerik.com/kendo-ui/framework/mvvm/observableobject#dependent-methods

    Thanks so much,
    Grant

Back to Top