Я использовал Angular-cli для начальной настройки кода. Мне нужно интегрировать Угловая 2: Toastr библиотека, но некоторые, как я не могу использовать. Он отлично работал, когда я использовал без формата Angular-cli. Я получаю следующую ошибку. когда я выполняю код тоста.Angular2: Невозможно прочитать свойство 'vcRef' of undefined
error_handler.js:47 EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'vcRef' of undefined
TypeError: Cannot read property 'vcRef' of undefined
at http://localhost:4200/main.bundle.js:42306:101
at new ZoneAwarePromise (http://localhost:4200/main.bundle.js:63592:29)
at ToastsManager.show (http://localhost:4200/main.bundle.js:42297:16)
at ToastsManager.success (http://localhost:4200/main.bundle.js:42395:21)
at AppComponent.showSuccess (http://localhost:4200/main.bundle.js:41105:21)
at CompiledTemplate.proxyViewClass.View_AppComponent0.handleEvent_0 (/AppModule/AppComponent/component.ngfactory.js:34:34)
at CompiledTemplate.proxyViewClass.<anonymous> (http://localhost:4200/main.bundle.js:52326:37)
at HTMLButtonElement.<anonymous> (http://localhost:4200/main.bundle.js:27715:36)
at ZoneDelegate.invokeTask (http://localhost:4200/main.bundle.js:63339:35)
at Object.onInvokeTask (http://localhost:4200/main.bundle.js:25786:37)
Я выполнение следующего кода,
import {Component} from "@angular/core";
import { ToastsManager } from 'ng2-toastr/ng2-toastr';
@Component({
selector: 'app-root',
template: '<button class="btn btn-default" (click)="showSuccess()">Toastr Tester</button>'
})
export class AppComponent {
constructor(public toastr: ToastsManager) {
}
showSuccess() {
this.toastr.success('You are awesome!', 'Success!');
}
}
Угловой версия 2.2.1
Спасибо заранее.
Работая спасибо. –