Property 'alertService' and 'options' does not exist on type 'AppComponent'

Discussão em 'Angular' iniciado por krishna veer, Dezembro 21, 2024.

  1. krishna veer

    krishna veer Guest

    I'm implementing alert services in my applications however I get the error Property 'alertService' does not exist on type 'AppComponent' and Property 'options' does not exist on type 'AppComponent'

    app.component.html:

    <div class="form-group">
    <button [disabled]="frmSignup.invalid" type="submit" class="btn btn-primary btn-block font-weight-bold"
    (click)="alertService.success('Success!!', options)">Submit</button>
    </div>


    app.component.ts:

    export class AppComponent {
    public frmSignup: FormGroup;
    public message = "Congrats you have successfully created your account";

    constructor(private fb: FormBuilder) {
    this.frmSignup = this.createSignupForm();
    }

    createSignupForm(): FormGroup {
    return this.fb.group(
    {
    ........
    }
    );
    }

    submit() {
    // do signup or something
    console.log(this.frmSignup.value);
    alert(this.message);
    }

    Continue reading...

Compartilhe esta Página