Reputation: 15702
I am getting below error when trying to build my Angular 6 app.
ERROR in src/app/util/notification.service.ts(14,9): error TS1005: ':' expected.
Here is the related code
import { Injectable } from '@angular/core';
import { ToastrService } from 'ngx-toastr';
@Injectable()
export class NotificationService {
timeOut: number = 5000;
constructor(private toastr: ToastrService) {}
error(toast_msg, msg_title){
this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, {
this.timeOut
});
}
}
What could be the issue?
Upvotes: 3
Views: 2323
Reputation: 68635
Error is related to TypeScript configuration.
Create your object by explicitly giving property name
{ timeout: this.timeOut }
Upvotes: 3
Reputation: 4145
Issue with you are not using key value pair for timeOut
Try this,
error(toast_msg, msg_title) {
this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, {
timeOut: this.timeOut
});
}
Upvotes: 1
Reputation: 8295
You probably want something like:
this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, {
timeout: this.timeOut,
});
or, since rest of the parameters are passed as args:
this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, this.timeOut);
Upvotes: 7