错误TS1005:':'期望TypeScript Angular6

Bis*_*han 3 typescript tslint angular

在尝试构建我的Angular 6应用程序时,我遇到了以下错误.

src/app/util/notification.service.ts(14,9)中的错误:错误TS1005:':'预期.

这是相关的代码

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
            });
   }

}
Run Code Online (Sandbox Code Playgroud)

可能是什么问题?

And*_*tar 7

你可能想要这样的东西:

this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, {
  timeout: this.timeOut,
});
Run Code Online (Sandbox Code Playgroud)

或者,因为其余的参数作为args传递:

this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, this.timeOut);
Run Code Online (Sandbox Code Playgroud)