如何使用角度种子2安装Angular材料最后版本2.0.0-beta.10

时间:2017-08-31 09:40:31

标签: angular angular-material2

我使用主页上的get get console line

安装了角度材质

npm install --save @angular/material @angular/cdk

但我收到此错误

  

http://localhost:5574/node_modules/@angular/cdk/a11y.js as "@angular/cdk/a11y"

这是需要"@angular/material": "^2.0.0-beta.10"

"@angular/cdk": "^2.0.0-beta.10",

我在cdk文件夹中看不到任何a11y.js

2 个答案:

答案 0 :(得分:3)

我终于让它运行了,我不得不在我的project.config.ts

上添加一些代码行
      let additionalPackages: ExtendPackages[] = [
      {
        name: '@angular/cdk/a11y',
        path: 'node_modules/@angular/cdk/bundles/cdk-a11y.umd.js'
       },

       {
        name: '@angular/cdk/bidi',
        path: 'node_modules/@angular/cdk/bundles/cdk-bidi.umd.js'        
       },

       {
        name: '@angular/cdk/observers',
        path: 'node_modules/@angular/cdk/bundles/cdk-observers.umd.js'        
       },

       {
        name: '@angular/cdk/overlay',
        path: 'node_modules/@angular/cdk/bundles/cdk-overlay.umd.js'        
       },

       {
        name: '@angular/cdk/portal',
        path: 'node_modules/@angular/cdk/bundles/cdk-portal.umd.js'        
       },

       {
        name: '@angular/cdk/scrolling',
        path: 'node_modules/@angular/cdk/bundles/cdk-scrolling.umd.js'        
       },

       {
        name: '@angular/cdk/platform',
        path: 'node_modules/@angular/cdk/bundles/cdk-platform.umd.js'        
       },

       {
        name: '@angular/cdk/keycodes',
        path: 'node_modules/@angular/cdk/bundles/cdk-keycodes.umd.js'        
       },

       {
        name: '@angular/cdk/coercion',
        path: 'node_modules/@angular/cdk/bundles/cdk-coercion.umd.js'        
       },

       {
        name: '@angular/cdk/collections',
        path: 'node_modules/@angular/cdk/bundles/cdk-collections.umd.js'        
       },

       {
        name: '@angular/cdk/rxjs',
        path: 'node_modules/@angular/cdk/bundles/cdk-rxjs.umd.js'        
       },

       {
        name: '@angular/cdk/table',
        path: 'node_modules/@angular/cdk/bundles/cdk-table.umd.js'        
       }

看起来他们都需要,否则我会收到一个未找到的错误,a11y.js umd bundles class BookingForm(forms.ModelForm): date_start = forms.DateField(widget=SelectDateWidget(years=range(1980, 2018))) class Meta: model = Booking fields = ('date_start', ) widgets = {'date_start': SelectDateWidget()} class BookingListView(ListView, FormView): model = models.Booking form_class = BookingForm queryset = models.Booking.objects.all() # order_by('-date_start') paginate_by = 80 template_name = 'events/archive_list.html' context_object_name = 'object_list' date_field = 'date_start' allow_future = True def get_context_data(self, **kwargs): context = super(BookingListView, self).get_context_data(**kwargs) context['mode'] = 'archive' context['form'] = BookingForm() return context def get_success_url(self): return reverse('archive:archive_month_numeric', kwargs={'year': 2014, 'month': 10}) 那个

答案 1 :(得分:0)

我有同样的问题但是使用systemJS。我不得不将此广告发送到我的systemjs.config.js:

        '@angular/cdk/a11y':'npm:/@angular/cdk/bundles/cdk-a11y.umd.js',
        '@angular/cdk/bidi':'npm:/@angular/cdk/bundles/cdk-bidi.umd.js',
        '@angular/cdk/observers':'npm:/@angular/cdk/bundles/cdk-observers.umd.js',
        '@angular/cdk/overlay':'npm:/@angular/cdk/bundles/cdk-overlay.umd.js',
        '@angular/cdk/portal':'npm:/@angular/cdk/bundles/cdk-portal.umd.js',
        '@angular/cdk/scrolling':'npm:/@angular/cdk/bundles/cdk-scrolling.umd.js',
        '@angular/cdk/platform':'npm:/@angular/cdk/bundles/cdk-platform.umd.js',
        '@angular/cdk/keycodes':'npm:/@angular/cdk/bundles/cdk-keycodes.umd.js',
        '@angular/cdk/coercion':'npm:/@angular/cdk/bundles/cdk-coercion.umd.js',
        '@angular/cdk/collections':'npm:/@angular/cdk/bundles/cdk-collections.umd.js',
        '@angular/cdk/rxjs':'npm:/@angular/cdk/bundles/cdk-rxjs.umd.js',
        '@angular/cdk/table':'npm:/@angular/cdk/bundles/cdk-table.umd.js',

似乎应该有更好的方法来做到这一点,但这很有用。