Disclaimer: I am still learning about angular and TypeScript in general.
My goal is to create an activation component that can submit a code directly to the service if it's included in the URL parameter query. If the code is not in the URL, then the user should be able to input the code into a form and submit it to the service. The field should be disabled when there's a code in the URL query and enabled otherwise.
The current issue I'm facing has to do with submitting the code to the service, which is resulting in the following error:
ERROR TypeError: Cannot read property 'get' of undefined
at ActivationComponent.handleActivation (activation.component.ts:48)
Previously, I had this.validateform.value
on line 48, but it led to the same error.
I've been trying different approaches for a while now and feeling a bit lost...
Here's what the component.ts looks like:
import {Component, Input, Output, EventEmitter, AfterViewInit, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {AuthService} from '../auth/auth.service';
@Component({
selector: 'app-activation',
templateUrl: './activation.component.html',
styleUrls: ['./activation.component.scss']
})
export class ActivationComponent implements OnInit {
// Component properties
}
And this is the current HTML structure:
<!-- HTML content -->