InfomediaLtd / angular2-materialize

Angular 2 support for Materialize CSS framework.
https://infomedialtd.github.io/angular2-materialize/
MIT License
406 stars 139 forks source link

MaterializeAction emit failing with 'Cannot match any routes' #186

Open CNSKnight opened 7 years ago

CNSKnight commented 7 years ago

EXCEPTION: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'myModalTarget'

The trigger anchor looks like this:

<a class="btn modal-trigger" materialize="modal"
 [materializeParams]="[{dismissible: true, starting_top:'1%', ending_top: '3%'}]"
 href="#myModaTarget"
 [materializeActions]="modalActions" (click)="openModal()">Preview</a>

I had this working in a System.js stack, but no-go here. If anyone has an insight, thanks in advance.

rubyboy commented 7 years ago

@CNSKnight check out the examples on how to open modals. I think this one suits what you're looking for: https://github.com/InfomediaLtd/angular2-materialize/blob/master/app/components/dialogs.ts#L10

Angular uses your href and thinks it's a route change, so try to avoid that if you don't have a myModaTarget route.