title: Angular2: Views stored in database
body: <p>I'm working on a GUI prototype using Angular2. One of the most important requirements is to store the HTML code (component's template) in database. Only one solution comes to my mind: </p>
  
  <ul>
  <li><p>Create a set of components:</p>
  
  <ul>
  <li>my-layout</li>
  <li>my-field</li>
  <li>my-text-box</li>
  </ul></li>
  <li><p>Save in database something like this:</p></li>
  </ul>
  
  <p><code>&lt;my-layout [rows]="" [cols]=""...&gt;
    &lt;my-field [name]="" [length]=""...&gt;&lt;/my-field&gt;
    &lt;my-text-box [name]=""...&gt;&lt;/my-text-box&gt;
   &lt;/my-layout&gt;</code></p>
  
  <ul>
  <li>Create a "loader-component" that gets the template from database and loads all the components.</li>
  </ul>
  
  <p>At the moment, i'm trying to create the "loader-component" with no success.It creates a component dynamically but i can't set the data from database as component's template. If i use the "Renderer", it only prints text. It doesn't recognize component's selectors.</p>
  
  <p>Any ideas?</p>
  
  <p>I'm not sure if this approach follows the "Angular-way" and i think we are trying to do something that Angular is not created for.</p>
  
  <p>Someone knows any modern JS library/framework to achieve this???.</p>
  
  <p>Thank you very much!</p>