mike
mike

Reputation: 7

what is # symbol functinality, in angular while interpolating value

from this link, https://angular.io/guide/lifecycle-hooks the foll. example is given

export class PeekABoo implements OnInit {
  constructor(private logger: LoggerService) { }

  // implement OnInit's `ngOnInit` method
  ngOnInit() { this.logIt(`OnInit`); }

  logIt(msg: string) {
    this.logger.log(`#${nextId++} ${msg}`);
  }
}

In this example, I do not understand, what # symbol does here. I referred angular documentation, it says # is used to create refs. but this is not form or any field to create ref.

Upvotes: 0

Views: 143

Answers (1)

Estus Flask
Estus Flask

Reputation: 222750

In this example # is a character in a log line and is used as number sign.

It has no special meaning here and shouldn't be confused with Angular template reference variables.

Upvotes: 1

Related Questions