Skip to content

Instantly share code, notes, and snippets.

@JIntrocaso
Created Sep 23, 2020
Embed
What would you like to do?
Landing Page Code
<h1 *ngIf='campaign'>{{campaign.headline}}</h1>
<app-campaign-display *ngIf='!showSignupForm && !loading' (signupButtonClicked)='handleSignupButtonClick($event)' [campaign]='campaign'></app-campaign-display>
<app-campaign-signup *ngIf='showSignupForm && !formSubmitted && !loading' (submitButtonClicked)='showThankYou($event)' [campaign]='campaign'></app-campaign-signup>
<app-campaign-thankyou *ngIf='formSubmitted && !loading' [campaign]='campaign'></app-campaign-thankyou>
import { Component, OnInit } from '@angular/core';
import { CampaignService } from 'src/app/services/campaign.service';
@Component({
selector: 'app-landing-page',
templateUrl: './landing-page.component.html',
styleUrls: ['./landing-page.component.scss']
})
export class LandingPageComponent implements OnInit {
public campaignTitle = 'Campaign Title Goes Here';
public showSignupForm = false;
public formSubmitted = false;
public campaign;
public loading = true;
constructor(private campaignService: CampaignService) { }
ngOnInit(): void {
this.campaignService.getCampaignData().subscribe(res => {
console.log(res);
this.campaign = res;
this.loading = false;
});
}
public handleSignupButtonClick(value): void {
this.showSignupForm = value;
}
public showThankYou(value): void {
this.formSubmitted = value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment