Error after import the modules
See original GitHub issueAngular 2 version: 2.1.2
ng2-pagination version: 1.0.1
Description of issue:
Error: (SystemJS) Unexpected token <
SyntaxError: Unexpected token <
at eval (<anonymous>)
at Object.eval (http://localhost:3000/app/app.module.js:15:24)
at eval (http://localhost:3000/app/app.module.js:64:4)
at eval (http://localhost:3000/app/app.module.js:65:3)
Evaluating http://localhost:3000/ng2-pagination
Evaluating http://localhost:3000/app/app.module.js
Evaluating http://localhost:3000/app/main.js
Error loading http://localhost:3000/app/main.js
at eval (<anonymous>)
at Object.eval (http://localhost:3000/app/app.module.js:15:24)
at eval (http://localhost:3000/app/app.module.js:64:4)
at eval (http://localhost:3000/app/app.module.js:65:3)
Evaluating http://localhost:3000/ng2-pagination
Evaluating http://localhost:3000/app/app.module.js
Evaluating http://localhost:3000/app/main.js
Error loading http://localhost:3000/app/main.js
After I import the page modules in appModule
Any relevant code:
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
import { HttpModule, JsonpModule } from '@angular/http';
import { RouterModule } from '@angular/router';
import { Ng2PaginationModule } from 'ng2-pagination';
import { AppComponent } from "./components/app/app.component";
import { BookFormComponent } from "./components/book-form/book-form.component";
import { BookComponent } from "./components/book/book.component";
import { BookDetailComponent } from "./components/book-detail/book-detail.component";
import { BookListComponent } from "./components/book-list/book-list.component";
import { PostComponent } from "./components/post/post.component";
import { PostListComponent } from "./components/post-list/post-list.component";
import { PostDetailComponent } from "./components/post-detail/post-detail.component";
import { PostFormComponent } from "./components/post-form/post-form.component";
import { BookService } from "./services/books/books.service";
import { PostService } from "./services/posts/posts.service";
@NgModule({
imports: [
BrowserModule,
HttpModule,
JsonpModule,
Ng2PaginationModule,
RouterModule.forRoot([
{
path: '',
redirectTo: 'book-list',
pathMatch: 'full'
},
{ path: 'book-list', component: BookListComponent },
{ path: 'book-list/new', component: BookFormComponent },
{ path: 'book-list/:id', component: BookDetailComponent },
{ path: 'post-list', component: PostListComponent },
{ path: 'post-list/:id', component: PostDetailComponent },
{ path: 'post-list/form/new', component: PostFormComponent }
])
],
declarations: [
BookComponent, BookListComponent, AppComponent, BookDetailComponent, BookFormComponent,
PostComponent, PostListComponent, PostDetailComponent, PostFormComponent
],
providers: [BookService, PostService],
bootstrap: [AppComponent]
})
export class AppModule { }
import { Component, ChangeDetectionStrategy } from "@angular/core";
import { OnInit } from "@angular/core";
import { PaginationInstance } from "ng2-pagination";
import { IPost } from "../../interfaces/posts/ipost";
import { PostService } from "../../services/posts/posts.service";
@Component({
selector: "post-list",
templateUrl: "./app/components/post-list/post-list.component.html"
})
export class PostListComponent implements OnInit {
page: number = 1;
postList: IPost[];
async ngOnInit() {
this.postList = await this.postService.getAllPosts();
}
constructor(private postService: PostService) {
}
}
<section>
<h1>Some posts</h1>
<p>There are many other story posts in the world, but here are like 20 of them</p>
<post *ngFor="let post of postList | paginate: { itemsPerPage: 20, currentPage: page }" [post]=post ></post>
<pagination-controls (pageChange)="page = $event"></pagination-controls>
</section>
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Python import module error - Stack Overflow
Here's my best guess as to what might help: You should make sure that the path to the directory in which your main.py...
Read more >Python Import Error (ModuleNotFoundError) - Finxter
Python's ImportError ( ModuleNotFoundError ) indicates that you tried to import a module that Python doesn't find. It can usually be eliminated by...
Read more >ModuleNotFoundError: no module named Python Error [Fixed]
For resolving an imported module, Python checks places like the inbuilt library, installed modules, and modules in the current project. If it's ...
Read more >Resolve "Unable to import module" errors from Python ... - AWS
I receive an "Unable to import module" error when I try to run my AWS Lambda code in Python. How do I resolve...
Read more >Error when importing modules : r/learnpython - Reddit
Visual Studio may be using a different Python installation and this may be the reason it can't find the praw library. For the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I ran into the same issue but sorted it with some help from the plunkr posted above. Point the library to the dist-folder under npm.
'ng2-pagination': 'npm:ng2-pagination/dist/'Then add a declaration under packages pointing to the main .js file as per the plunkr.
}, 'ng2-pagination': { defaultExtension: 'js', main: 'ng2-pagination.js' }@jsunebring I can confirm that this fixes the issue.