首页 > 解决方案 > console.log() not showing in any browser in angular 6 project

问题描述

This is an ongoing angular OTA project. All the logging worked before, until suddenly they stopped working. None of the previously written console.log are outputting anything in the browser console.

ngOnInit() {
    console.log('Hiiiii');
    this.imgUrl = this.allapi.imageUrl;
    this.journeyType = JSON.parse(sessionStorage.getItem('journeyType'));
    this.bookingData = JSON.parse(sessionStorage.getItem('payload'));
    if (this.bookingData.FareBreakdown.length > 0) {
      this.fareBreakDown = this.bookingData.FareBreakdown;
    } else {

    }
    this.calculateLayover();

    sessionStorage.setItem('promoApplied', JSON.stringify(this.promoApplied));

    if (this.journeyType == 3) {
      this.layover_multi = JSON.parse(sessionStorage.getItem('layoverMulti'));
      this.multiCityPlaces = JSON.parse(sessionStorage.getItem('multi_places_list'));
    }
    this.getFareBreakDown();
  }

In the ngoninit() the first console.log is not showing any output in the browser.

stackblitz link: https://stackblitz.com/edit/angular-5pvvrq

标签: javascriptangular

解决方案


在您的 index.html 中,<script src="https://scripts.sandbox.bka.sh/versions/1.0.0-beta/checkout/bKash-checkout-sandbox.js"></script>这一行破坏了您的代码。因为在这个js中覆盖了console.log函数。如果您不使用,请删除此脚本。

https://angular-8vvejy.stackblitz.io/


推荐阅读