I am trying to set a default value from the constructor params, and trying to print in html. but getting error as
No suitable injection token for parameter 'name' of class 'AppComponent'.
Consider adding a type to the parameter or use the @Inject decorator to specify an injection token.
not able to understand. any one help me here. my code:
import { Component, VERSION } from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
constructor(public name = 'Angular') {} //default value moved with constructor
}
what is wrong here or how to handle this kind of issue? How to parameterise a value in component? Thanks in advance.