Reputation: 71
In settings.ts, I have the code below:
@Component({
selector: 'page-settings',
templateUrl: 'settings.html'
})
export class SettingsPage {
}
}
and in the app.component.ts, we can write the code below:
settingsPage = SettingsPage;
Why can the Class name SettingsPage
be assigned to a variable?
Upvotes: 0
Views: 23
Reputation: 1506
Technically, Typescript is a superset of JavaScript. Since classes don't actually exist in a strict sense in JS, they are implemented as objects (with some extra's).
So what you're doing is simply getting an object SettingsPage
(with a bunch of methods and properties) and assigning it to the variable settingsPage
.
Upvotes: 1