0

I am trying to use ng2-datepicker in my Angular 2 app. I followed the instructions given in the above page but the date-picker is not showing up. The console logs following error.

url_resolver.js:248 Uncaught TypeError: uri.match is not a function

My app.module.ts

import { DatePicker } from 'ng2-datepicker/ng2-datepicker';

@NgModule({
    declarations: [
        AppComponent,
        DatePicker
    ],

app.component.html

<datepicker [(ngModel)]="date" [expanded]="true"></datepicker>

Angular version 2.0.0

package.json

"dependencies": {
    "@angular/common": "2.0.0",
    "@angular/compiler": "2.0.0",
    "@angular/core": "2.0.0",
    "@angular/forms": "2.0.0",
    "@angular/http": "2.0.0",
    "@angular/platform-browser": "2.0.0",
    "@angular/platform-browser-dynamic": "2.0.0",
    "@angular/router": "3.0.0",
    "@material2-extra/calendar": "0.0.14-1",
    "core-js": "^2.4.1",
    "moment": "^2.15.1",
    "ng2-datepicker": "^1.1.0",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },

Any suggestions ?

Thank You

Arnaud Denoyelle
  • 29,980
  • 16
  • 92
  • 148
Rose18
  • 2,892
  • 8
  • 47
  • 98

2 Answers2

0

https://github.com/angular/material2/issues/974

What is the module builder, that use?

don't use module.id in the component.

Kiss Robert
  • 201
  • 3
  • 7
0

This is an ongoing issue as of Angular 2.0.0 where if you are using webpack and the package (in your case ng2-datepicker) has a component which uses module.id you will get this error. According to this issue it is fixed in 2.0.1 but I haven't has a chance to confirm that. Hopefully moving to that version will fix it for you.

If not I've had the issue on two of my packages and had to move the html and css inline to support webpack users. You can either contact the publisher of the package to see if they will use that workaround.

JayChase
  • 11,174
  • 2
  • 43
  • 52