How do I use StepperComponent from _StepperComponent.ts file in Angular project.
I copied this from html documentation and tried to make use of it, but couldn't make it work, couldn't find docs with anything other than html.
<div class="stepper stepper-pills stepper-column d-flex flex-column flex-xl-row flex-row-fluid" id="kt_modal_create_app_stepper">
<div ... ></div>
</div> Hi Luzan Baral
Sorry for the delay in response. To use the StepperComponent in an Angular project, you can follow these steps:
In your Angular component where you want to use the StepperComponent, import the plugin.
import { StepperComponent, defaultStepperOptions } from '';
Initialize the StepperComponent in your Angular component. You can use the ngAfterViewInit lifecycle hook to ensure the DOM elements are ready.
import { AfterViewInit, Component, ElementRef } from '@angular/core';
@Component({
selector: 'app-stepper',
template: `
`,
})
export class StepperComponent implements AfterViewInit {
constructor(private elementRef: ElementRef) {}
ngAfterViewInit(): void {
const stepperElement = this.elementRef.nativeElement.querySelector('[data-kt-stepper]');
if (stepperElement) {
new StepperComponent(stepperElement, defaultStepperOptions);
}
}
}
Use the app-stepper component in your Angular template.
Add the necessary HTML structure and content within the app-stepper component's template.
Step 1Content 1Step 2Content 2Step 3Content 3
Style the stepper component as per your design requirements and enhance its functionality using Angular features as needed.
Adjust the StepperComponent initialization code to fit your Angular project's structure and requirements.