我在尝试构建我的 Angular 6 应用程序时遇到错误。
ERROR in src/app/util/notification.service.ts(14,9): error TS1005: ':' expected.
相关代码如下
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
});
}
}
可能是什么问题?
最佳答案
你可能想要这样的东西:
this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, {
timeout: this.timeOut,
});
或者,由于其余参数作为 args 传递:
this.toastr.error('<span class="now-ui-icons ui-1_bell-53"></span> ' + toast_msg, msg_title, this.timeOut);
关于angular - 错误 TS1005 : ':' expected TypeScript Angular6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51929373/