我嘗試使用Library ng2-page-scroll,但按照他們的步驟顯示文件未找到ng2-page-scroll。 它似乎是systemjs.config中的錯誤任何人都知道如何解決這個問題?未找到文件ng2-page-scroll
安裝NG2-頁滾動
npm install ng2-page-scroll --save
在app.module
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import {Ng2SimplePageScrollModule} from "ng2-simple-page-scroll";
@NgModule({
imports: [ BrowserModule ,Ng2SimplePageScrollModule.forRoot()],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
在systemjs.config
(function (global) {
System.config({
paths: {
// paths serve as alias
'npm:': 'node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
'ng2-simple-page-scroll/ng2-simple-page-scroll': 'ng2-simple-page-scroll/bundles/ng2-simple-page-scroll.umd.js',
// other libraries
'rxjs': 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app : {defaultExtension: 'js', main: './main.js'},
rxjs: {defaultExtension: 'js'},
}
});
})(this);
這裏沒有找到 ng2-page-scroll Not Found
結果文件
通過配置SystemJS來找到它。找出它在磁盤上的位置,並映射路徑。 –
謝謝@AluanHaddad我已經試圖將它映射出來,但它仍然不起作用。 地圖= { 'NG2-簡單頁滾動/ NG2-簡單頁滾動': 'NG2-簡單頁滾動/捆綁/ NG2-簡單頁-scroll.umd.js', } 任何想法來解決這個問題? 下面是該庫的鏈接 https://github.com/Nolanus/ng2-page-scroll –
它不需要是''ng2-simple-page-scroll/ng2-simple-page-滾動':'npm:ng2-simple-page-scroll/bundles/ng2-simple-page-scroll.umd.j s''?如果這不起作用,請發佈您的配置。沒有足夠的信息來回答。 –