Bha*_*eni 7 angular-material angular
我正在尝试在Angular2中集成ng2-material
Uncaught SyntaxError:angular2-polyfills.js:138 Uncaught SyntaxError:意外的令牌<评估 http:// localhost:3000/ng2-material/all
import {MATERIAL_PROVIDERS, MATERIAL_DIRECTIVES} from 'ng2-material/all';
   @Component({
       template: `<md-content>
                 <button md-raised-button class="md-raised md-primary">Primary</button>
                 </md-content>`,
       styles: [style],
       providers:[ContactService, MATERIAL_PROVIDERS]
       directives:[MATERIAL_DIRECTIVES]
    })
 export class contact {
    constructor(){}
}
这是我的配置.有效.你可以尝试一下.
System.config({
    packages: {        
      app: {
        format: 'register',
        defaultExtension: 'js'
      },
      'ng2-material': {
          defaultExtension: 'js'
       }
    },
    map: {
        'ng2-material': 'node_modules/ng2-material'
  },
});
System.import('app/main')
    .then(null, console.error.bind(console));
如果找不到适合您的库,请重试npm install。
否则,如果您确定已安装并下载了该库,请将其添加到您的index.html:
<script>
    System.config({
        defaultJSExtensions: true,
        packages: {
            "/angular2": {"defaultExtension": false}
        },
        map: {
            'ng2material': 'node_modules/ng2material'
        }
    });
</script>
| 归档时间: | 
 | 
| 查看次数: | 3690 次 | 
| 最近记录: |