What is the meaning of public mainCtrl: MainCtrl as a representative in ng4? Is it the grammar of es6? for the first time, ask for advice.

export class GoodsImgsComponent {

@ Input () data: any = [];

constructor (public mainCtrl: MainCtrl) {

}

}
Project see a lot of this usage first contact but do not understand what it means, Baidu does not know how to query, ask for advice

Mar.21,2021

look at the official documentation of Angular, which introduces that dependency injection (DI), has a special section on this.


MainCtrl refers to a class you introduce. Public defines the properties of a variable, which is public, and mainCtrl is an instance of MainCtrl

.
Menu