Unexpected token |
See original GitHub issueSo after implementing i keep getting this error any ideas whats wrong
EXCEPTION: Error: Uncaught (in promise): Template parse errors:
Parser Error: Unexpected token | at column 29 in [ngFor let course of courses | paginate: { itemsPerPage: 2, currentPage: p }] in CourseListComponent@10:28 ("
</div>
<div class="row">
<div class="list-group" [ERROR ->]*ngFor="let course of courses | paginate: { itemsPerPage: 2, currentPage: p }">
<a href="#" c"): CourseListComponent@10:28
heres corelistcomponenets
import {Component} from 'angular2/core';
import {Api} from "../../../services/api";
import {CourseRemoveComponent} from "../remove/CourseRemoveComponent"
import {PaginatePipe, PaginationControlsCmp, PaginationService} from 'ng2-pagination';
import {
ROUTER_DIRECTIVES
} from 'angular2/router';
@Component({
selector: 'course',
templateUrl: './app/components/courses/list/index.html',
directives: [ROUTER_DIRECTIVES, CourseRemoveComponent, PaginationControlsCmp],
pipes: [PaginatePipe],
providers: [PaginationService]
})
export class CourseListComponent {
courses: Object;
selectedCourse: Object = {};
constructor(private _api: Api) {
this.courses = this._api.courses$;
this._api.getCourses();
}
}
and the template
<div class="row">
<h5 class="text-center text-muted">Course List</h5>
<hr>
<div class="pull-right" style="margin-bottom: 10px;">
<button class="btn btn-md btn-success" [routerLink]="['CourseCreate']">
Add new course
</button>
</div>
</div>
<div class="row">
<div class="list-group" *ngFor="let course of courses | paginate: { itemsPerPage: 2, currentPage: p }">
<a href="#" class="list-group-item clearfix">
<span class="glyphicon glyphicon-file"></span>
Author: {{ course.author }}, Name: {{ course.name }}, Price: {{ course.price }}
<span class="pull-right">
<button class="btn btn-md btn-success" [routerLink]="['CourseDetail', {id:course.id}]">
<span class="glyphicon glyphicon-search"></span>
</button>
<button class="btn btn-md btn-info" [routerLink]="['CourseEdit', {id:course.id}]">
<span class="glyphicon glyphicon-pencil"></span>
</button>
<button href="#remove-course" data-toggle="modal" class="btn btn-md btn-danger" (click)="selectedCourse = course">
<span class="glyphicon glyphicon-trash"></span>
</button>
</span>
</a>
</div>
<course-remove [course]="selectedCourse"></course-remove>
</div>
<pagination-controls id="some_id"
(pageChange)="pageChanged($event)"
maxSize="9"
directionLinks="true"
autoHide="true">
</pagination-controls>
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:5 (3 by maintainers)
Top Results From Across the Web
SyntaxError: Unexpected token - JavaScript - MDN Web Docs
The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided.
Read more >Have a JavaScript Unexpected Token Error? Check Your Syntax
The JavaScript's parser expects tokens and symbols in a particular order, with relevant values or variables in between. Often, an Unexpected ...
Read more >syntax error: unexpected token - javascript - Stack Overflow
The error SyntaxError: Unexpected token < likely means the API endpoint didn't return JSON in its document body, such as due to a...
Read more >JavaScript Error Handling: Unexpected Token - GeeksforGeeks
Not follow them throws an error.An unexpected token occurs if JavaScript code has a missing or extra character { like, ) + –...
Read more >How to fix JavaScript unexpected token error
As you write your JavaScript application, the unexpected token error always occurs because JavaScript expected a specific syntax that's not ...
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

Thanks for the report. I’ll look into it as soon as I get some time.
I’m closing this issue because further data was needed but was not provided. If you want to continue the thread, feel free to re-open.