Angular2 - MaterializeCSS: Modal dialogs don't open
<p>I'm using Angular2 with materializecss.
At the moment I'm trying to create modal dialogs which open on button click. There is also an example in the docs <a href="https://www.npmjs.com/package/angular2-materialize" rel="nofollow noreferrer">https://www.npmjs.com/package/angular2-materialize</a>.</p>

<p>I also use a materilize-select which works perfectly fine, so I guess the installation, imports etc. are correct.</p>

<p>The problem is, when I click the modal-trigger the router resolves the new Route "localhost:4200/#modal1" and I'm redirected to my startpage.</p>

<p>I also tried to replace href with <code>data-target="modal1"</code> but that didn't work either.</p>

<p>Can I somehow disable the Hash-Links for the Router? My other routes are without hashes.</p>

<p>Heres the example from npm docs. I copied this part 1:1.</p>

<pre><code>&lt;!-- Modal Trigger --&gt;
&lt;a materialize="leanModal" [materializeParams]="[{dismissible: false}]" class="waves-effect waves-light btn modal-trigger" href="#modal1"&gt;Modal&lt;/a&gt;
&lt;!-- Modal Structure --&gt;
&lt;div id="modal1" class="modal"&gt;
  &lt;div class="modal-content"&gt;
    &lt;h4&gt;Modal Header&lt;/h4&gt;
    &lt;p&gt;A bunch of text&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class="modal-footer"&gt;
    &lt;a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat"&gt;Agree&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Any help/hints are appreciated!</p>

<p>Edit: I changed the anchor to call a function on click</p>

<pre><code>&lt;a materialize="leanModal" [materializeParams]="[{dismissible: false}]" class="waves-effect waves-light btn modal-trigger" (click)="openModal()&gt;Modal&lt;/a&gt;
</code></pre>

<p>which triggers </p>

<pre><code>$('#modal1').openModal()
</code></pre>

<p>But now I get an error:
<a href="https://i.stack.imgur.com/hSYxu.png" rel="nofollow noreferrer">j.velocity is not a function</a></p>

<p>Edit 2:</p>

<p>Got it to open the modals by using jQuery instead of $. I still get the error and the Application is stuck after opening the modal.</p>