Z
Z
zlodiak2018-03-24 20:19:09
Browsers
zlodiak, 2018-03-24 20:19:09

Why aren't console.logs being output?

There are two related components, one embedded in the other. The first component generates values, the second outputs them.
component1:

private rows: Array<any> = [];
  
  constructor() {
    for (let i = 0; i < 10; i++) {
      this.rows.push(Math.random().toString(30).substring(2, 10));
    }
    
    setInterval(() => {      
      const ind = Math.ceil(Math.random()*10);
      this.rows[ind] = '--------';
      console.log('interval', ind);
    }, 2500)
  }

component2:
@Input() public data: string;

  constructor() { 
    console.debug('constructor');
  }

  ngOnInit() {
    console.debug('ngOnInit');
  }

  ngOnChanges(): void {
    console.debug('change');
  }  
  
  get rowData(): string {
    console.debug('getting row data');
    return this.data;
  }

The problem is that the second component doesn't output any console.log(). Please help me understand why and correct the situation.
Here's a sandbox with a minimal example

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-03-24
@zlodiak

The problem is that the second component doesn't output any console.log().

Because you don't have a single console.log there - there is console.debug.
Your browser is Chrome, right? - it does not display debug by default. The console has a drop-down list that lists the types of messages that need to be displayed - Verbose, Info, Warnings, Errors - check all. Well, or replace debug with log.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question