Q:

Magento 2 custom tab on customer section in admin panel

I have created one custom tab section in customer dashboard area in back end.

In this section i have called one phtml file, in this phtml i want to load on js using magento x-init.
Please check below code.
<script type="text/x-magento-init">
    {
        "*": {
            "#magearray-attachments": {
                "magearrayFileUploadTwo": {
                }
            }
        }
    }
</script>

But, problem is js is not loading when i click on my custom tab "View Attachments". I have also assigned js in requirejs-config.js.
Can anyone help me with this?

A:

On page load, Magento is going to consume and initialize every data-mage-init and <script type="text/x-magento-init"> it can find in the DOM tree. Since your page is loaded through Ajax, Magento already went through the DOM tree. You're going to need to trigger the 'initializing process' manually. 
You can do this by trigger the contentUpdated event on your element like so $(#selected).trigger('contentUpdated'). 

