Unable run Angular material example in plunker

陌路散爱 提交于 2019-12-12 20:09:39

问题


I created one sample project using Angular Material example in plunker. its worked fine till yesterday today its not working.

Even Angular Material example is not working. can you please point me into right direction.

I was getting same error as original Angular material plunker error.

Error: (SystemJS) Unexpected value 'undefined' exported by the module 'PlunkerMaterialModule'
    Error: Unexpected value 'undefined' exported by the module 'PlunkerMaterialModule'
        at d (https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.7.2/zone.min.js:1:10303)
        at syntaxError (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:1729:34)
        at eval (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15596:40)
        at Array.forEach (<anonymous>)
        at CompileMetadataResolver.getNgModuleMetadata (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15594:49)
        at CompileMetadataResolver.getNgModuleSummary (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15507:52)
        at eval (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15580:72)
        at Array.forEach (<anonymous>)
        at CompileMetadataResolver.getNgModuleMetadata (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15565:49)
        at JitCompiler._loadModules (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:27000:70)
        at JitCompiler._compileModuleAndComponents (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:26973:36)
        at JitCompiler.compileModuleAsync (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:26902:37)
        at PlatformRef_._bootstrapModuleWithZone (https://unpkg.com/@angular/core/bundles/core.umd.js:4568:25)
        at PlatformRef_.bootstrapModule (https://unpkg.com/@angular/core/bundles/core.umd.js:4554:21)
        at execute (https://run.plnkr.co/preview/cj8fyb96l00063c5srholji8p/main.ts!transpiled:108:65)
    Error loading https://run.plnkr.co/preview/cj8fyb96l00063c5srholji8p/main.ts
        at d (https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.7.2/zone.min.js:1:10303)
        at syntaxError (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:1729:34)
        at eval (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15596:40)
        at Array.forEach (<anonymous>)
        at CompileMetadataResolver.getNgModuleMetadata (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15594:49)
        at CompileMetadataResolver.getNgModuleSummary (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15507:52)
        at eval (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15580:72)
        at Array.forEach (<anonymous>)
        at CompileMetadataResolver.getNgModuleMetadata (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:15565:49)
        at JitCompiler._loadModules (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:27000:70)
        at JitCompiler._compileModuleAndComponents (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:26973:36)
        at JitCompiler.compileModuleAsync (https://unpkg.com/@angular/compiler/bundles/compiler.umd.js:26902:37)
        at PlatformRef_._bootstrapModuleWithZone (https://unpkg.com/@angular/core/bundles/core.umd.js:4568:25)
        at PlatformRef_.bootstrapModule (https://unpkg.com/@angular/core/bundles/core.umd.js:4554:21)
        at execute (https://run.plnkr.co/preview/cj8fyb96l00063c5srholji8p/main.ts!transpiled:108:65)
    Error loading https://run.plnkr.co/preview/cj8fyb96l00063c5srholji8p/main.ts

https://plnkr.co/edit/GKuQv2GnExGPEE3iWynF?p=preview https://material.angular.io/components/tabs/examples

Thanks in Advance.


回答1:


md prefix was announced as deprecated in 2.0.0-beta.11 and seems now(2.0.0-beta.12) it is removed. We should use mat instead.

So instead of importing:

MdTabsModule

and

<md-tab-group class="demo-tab-group">
  <md-tab label="Tab 1">

use

MatTabsModule

and

<mat-tab-group class="demo-tab-group">
  <mat-tab label="Tab 1">

Plunker Example@2.0.0-beta.12

Or you can set angular-material version to @2.0.0-beta.11 explicitly:

'@angular/material': 'https://unpkg.com/@angular/material@2.0.0-beta.11/bundles/material.umd.js',

Plunker

I also advice you to see all examples here

  • https://github.com/angular/material2/tree/master/src/demo-app


来源:https://stackoverflow.com/questions/46607524/unable-run-angular-material-example-in-plunker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!