首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >web-动画.min.js加载失败

web-动画.min.js加载失败
EN

Stack Overflow用户
提问于 2018-01-17 12:20:39
回答 2查看 1.6K关注 0票数 0

我在我的页面表单本站中使用了分页。我遵循它的指示,下面是我在项目中的相关文件:

app.item.html

代码语言:javascript
复制
<mat-paginator [length]="100"
               [pageSize]="10"
               [pageSizeOptions]="[5, 10, 25, 100]">
</mat-paginator>

app.item.ts

代码语言:javascript
复制
import {Component} from '@angular/core';



@Component({

  templateUrl: './app.item-list.html',
  styleUrls: ['table-pagination-example.css']

})

export class ItemListComponent {

}

package.json

代码语言:javascript
复制
{
  "name": "art-shop",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular-devkit/schematics": "0.0.46",
    "@angular/animations": "^5.1.3",
    "@angular/cdk": "^5.0.4",
    "@angular/common": "^5.1.3",
    "@angular/compiler": "^5.1.3",
    "@angular/core": "^5.1.3",
    "@angular/forms": "^5.1.3",
    "@angular/http": "^5.1.3",
    "@angular/material": "^5.0.4",
    "@angular/platform-browser": "^5.1.3",
    "@angular/platform-browser-dynamic": "^5.1.3",
    "@angular/router": "^5.1.3",
    "core-js": "^2.4.1",
    "rxjs": "^5.4.1",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.14"
  },
  "devDependencies": {
    "@angular/cli": "^1.6.4",
    "@angular/compiler-cli": "^5.1.3",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.4",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~9.3.0",
    "codelyzer": "~4.0.2",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "npm-update-all": "^1.0.1",
    "protractor": "~5.2.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "^2.4.2"
  }
}

app.module.ts

代码语言:javascript
复制
@NgModule({
  declarations: [
    AppComponent,
    headerComponent,
    footerComponent,
    registerSellerComponent,
    ProductListComponent,
    ItemListComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatTableModule,
    MatPaginatorModule

  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {
}

我使用以下命令安装了web-animationsnpm install --save web-animations-js

并将<script src="../node_modules/web-animations-js/web-animations.min.js"></script>放在我的index.html和未注释的

代码语言:javascript
复制
import 'web-animations-js'

在我的polyfill.ts中,但不仅分页不起作用,而且是这样的,但我在浏览器中也看到了这个错误:

代码语言:javascript
复制
Loading failed for the <script> with source “http://localhost:4200/node_modules/web-animations-js/web-animations.min.js”.
EN

回答 2

Stack Overflow用户

发布于 2018-01-17 12:43:56

node_modules不是部署在应用程序中的。

在index.html中,将URL替换为CDN到web动画库:

代码语言:javascript
复制
<script src="https://cdnjs.cloudflare.com/ajax/libs/web-animations/2.3.1/web-animations.min.js"></script>
票数 0
EN

Stack Overflow用户

发布于 2018-01-17 18:33:47

您不需要包含一个用于web-animations-jsscript标记。应该已经由polyfills.ts来处理了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48301030

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档