A
A
AskJs2018-08-30 12:19:55
Angular
AskJs, 2018-08-30 12:19:55

Super() keyword in Angular?

I write code:

constructor() {
    super()
 }

I get Error: 'super' can only be referenced in a derived class.
What is the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Eugene, 2018-08-30
@evgshk

Apparently, the problem is that you do not understand what super() is and why it is needed. Well, inheritance in addition. Because in the text of the error everything is described quite clearly.
https://www.typescriptlang.org/docs/handbook/class...
https://metanit.com/web/typescript/3.2.php

V
Vladimir, 2018-08-30
@Casufi

Not all code showed
https://www.typescriptlang.org/docs/handbook/class... look for a piece according to the words Inheritance extends
If the class is not inherited from another, super is not written.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question