title: How do I inject a custom component from js in nativescript?
body: <p>Suppose I create a small component that takes an input and sets a label to show it.</p>
  
  <p><em>app/components/testComponent/testComponent.xml:</em></p>
  
  <pre><code>&lt;Label id="someLabel" loaded="onLoad"/&gt;
  </code></pre>
  
  <p><em>app/components/testComponent/testComponent.js:</em></p>
  
  <pre><code>exports.onLoad = args =&gt; {
      const obj = args.object;
  
      const label = obj.getViewById('someLabel');
      label.text = obj.someString || 'no string given';
  };
  </code></pre>
  
  <p>Now I can use this component in any of my pages</p>
  
  <pre><code>&lt;Page xmlns="http://schemas.nativescript.org/tns.xsd"
        xmlns:testComponent="components/testComponent"&gt;
      &lt;StackLayout&gt;
          &lt;testComponent:testComponent someString="hello {N}"/&gt;
      &lt;/StackLayout&gt;
  &lt;/Page&gt;
  </code></pre>
  
  <p>This seems to be the official way to do it and it works. But is there a way to inject this component in the page using javascript only?</p>