2016-10-07 89 views
0

我想在我的角2的应用程序使用ng2-datepicker。我遵循了上述页面中给出的说明,但日期选择器没有显示出来。控制台记录以下错误。NG2,日期选择器不工作

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

app.module.ts

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

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

app.component.html

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

角版本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" 
    }, 

有什么建议?

谢谢

+0

其中2个版本,您使用的角度,它在RC7 – harishr

+0

得到解决,我采用了棱角分明2稳定版本 – Rose18

回答

0

这是一个持续的问题,因为角2.0.0:如果你正在使用的WebPack和包(在你的情况NG2,日期选择器)有一个使用module.id你会得到这个错误的组件。根据this issue它固定在2.0.1,但我没有机会证实这一点。希望转到该版本将为您解决它。

如果没有,我对我的两个包的问题,​​必须移动HTML和CSS内嵌支持的WebPack用户。您可以联系该软件包的发布者以查看他们是否将使用该解决方法。