Skip to content

Instantly share code, notes, and snippets.

@JIntrocaso
Created September 23, 2020 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JIntrocaso/bb7fb412136e4661043b722b8a0ab436 to your computer and use it in GitHub Desktop.
Save JIntrocaso/bb7fb412136e4661043b722b8a0ab436 to your computer and use it in GitHub Desktop.
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