ng2-material angular2 kullanmaya çalışıyorum.ng2-material TypeError: all_2.Media.hasMedia bir işlev değil
EXCEPTION: TypeError: all_2.Media.hasMedia is not a function in [hasMedia('gt-sm') ? 'side' : 'over' in [email protected]:32]
EXCEPTION: Error: Uncaught (in promise): EXCEPTION: TypeError: all_2.Media.hasMedia is not a function in [hasMedia('gt-sm') ? 'side' : 'over' in [email protected]:32] ORIGINAL EXCEPTION: TypeError: all_2.Media.hasMedia is not a function ORIGINAL STACKTRACE: TypeError: all_2.Media.hasMedia is not a function at AppComponent.hasMedia (http://localhost:3000/app/app.component.js:67:40) at AbstractChangeDetector.ChangeDetector_AppComponent_0.detectChangesInRecordsInternal (viewFactory_AppComponent:114:31) at AbstractChangeDetector.detectChangesInRecords (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:9609:14) at AbstractChangeDetector.runDetectChanges (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:9592:12) at AbstractChangeDetector._detectChangesInViewChildren (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:9671:14) at AbstractChangeDetector.runDetectChanges (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:9596:12) at AbstractChangeDetector.detectChanges (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:9581:12) at ChangeDetectorRef_.detectChanges (http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:5252:16) at http://localhost:3000/node_modules/angular2/bundles/angular2.dev.js:12954:27 at Array.forEach (native) ERROR CONTEXT: [object Object]
Ve bütün all_2.Media.hasMedia
ilgili daha birçok hatalardır Muhtemelen bu o
neden olabilecek bir koddur:Sidenav bileşeni çalışırken, ben bu hataları alıyorum
hasMedia(breakSize: string): boolean {
return Media.hasMedia(breakSize);
}
instructions on ng2-material site'u takip ettim ve zaten ng2-material workin var g.
Bunu nasıl çözmeliyim?
benim bileşeninde hasMedia() tanımlamış: NG2 maddi web sitesinde şimdi açıklandığı gibi
: düzeltme sınıfa Medya enjekte ve sınıf yerel sürümü kullanmaktır ve yöntemde console.log kullandığından ve kontrol ettiğinden beri çağrılıyor. Artık işlevim kütüphanede Media bileşeninden bir hadMedia() çağırıyor. Sorunun ilk satırında bahsettiğim demo sitesini kontrol et. Bu cevabı almak için – Shri