TransWikia.com

How to access other UI components

Magento Asked on December 2, 2021

I would like to exchange data and / or call methods of another UI component. How can I access another UI component in Magento 2 knockout JS ?

2 Answers

This is how you get all the components:

require('uiRegistry').get(function(c){ console.log(c.name); });

Answered by ozzytop on December 2, 2021

List all components

var registry = require('uiRegistry');
registry.filter(function(value, key) {
    console.log(key);
    // console.log(value); 
});

Get a specific one

registry.get(
    'checkout.steps.billing-step.payment.payments-list.paypal_express.checkout.steps.billing-step.payment.payments-list.paypal_express.messages'
);

This is meant for debugging and might not be the best way to communicate between components.

From: http://devdocs.magento.com/guides/v2.1/ui_comp_guide/concepts/ui_comp_uiregistry.html

Answered by Alex on December 2, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP