title: to reuse html content in angular 5
body: <p>Before starting this question, I clarify that I am new so please be patient.
  I will try to explain myself.
  In bootstrap I can generate modals in the following way:</p>
  
  <p><code>[modal.component.html]</code></p>
  
  <pre><code>    &lt;!--&lt;button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal"&gt;Open Modal&lt;/button&gt;--&gt;
      &lt;!-- Modal --&gt;
      &lt;div id="myModal" class="modal fade" role="dialog"&gt;
        &lt;div class="modal-dialog"&gt;
  
          &lt;!-- Modal content--&gt;
          &lt;div class="modal-content"&gt;
            &lt;div class="modal-header"&gt;
              &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
              &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
            &lt;/div&gt;
            &lt;div class="modal-body"&gt;
              &lt;p&gt;Some text in the modal.&lt;/p&gt;
            &lt;/div&gt;
            &lt;div class="modal-footer"&gt;
              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  
        &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>I am trying to create a <code>service</code> so that I can invoke the previous modal where it requires it.</p>
  
  <p>I imagine something like that inside my <code>service</code> file.</p>
  
  <pre><code>generatePopup(){
    $('#myModal').modal('show');
  }
  </code></pre>
  
  <p>then every time you call the <code>service</code> (<code>generatePopup</code>) the modal should appear. I'm not sure how to do this, if you can guide me I would be very grateful.
  what I'm trying to do is save code and in any component I do not have to keep the html code  in every view, but I do call <code>generatePopup</code> and it invokes me to the modal.</p>
  
  <p>thanks</p>