Skip to content

Commit 02ceaa4

Browse files
committed
fix(angular): Forms use input event emitter to handle conditional rendering
1 parent 35b4fae commit 02ceaa4

File tree

49 files changed

+227
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+227
-149
lines changed

examples/angular/src/app/app.component.ts

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,7 @@ import { injectUI } from "@invertase/firebaseui-angular";
3434
} @else {
3535
<div class="max-w-sm mx-auto pt-36 space-y-6 pb-36">
3636
<div class="text-center space-y-4">
37-
<img
38-
src="/firebase-logo-inverted.png"
39-
alt="Firebase UI"
40-
class="hidden dark:block h-36 mx-auto"
41-
/>
37+
<img src="/firebase-logo-inverted.png" alt="Firebase UI" class="hidden dark:block h-36 mx-auto" />
4238
<img src="/firebase-logo.png" alt="Firebase UI" class="block dark:hidden h-36 mx-auto" />
4339
<p class="text-sm text-gray-700 dark:text-gray-300">
4440
Welcome to Firebase UI, choose an example screen below to get started!
@@ -80,38 +76,26 @@ export class UnauthenticatedAppComponent {
8076
template: `
8177
<div class="max-w-sm mx-auto pt-36 space-y-6 pb-36">
8278
<div class="border border-neutral-200 dark:border-neutral-800 rounded-md p-4 space-y-4">
83-
<h1 class="text-md font-medium">
84-
Welcome, {{ user().displayName || user().email || user().phoneNumber }}
85-
</h1>
79+
<h1 class="text-md font-medium">Welcome, {{ user().displayName || user().email || user().phoneNumber }}</h1>
8680
@if (user().email) {
8781
@if (user().emailVerified) {
8882
<div class="text-green-500">Email verified</div>
8983
} @else {
90-
<button
91-
class="bg-red-500 text-white px-3 py-1.5 rounded text-sm"
92-
(click)="verifyEmail()"
93-
>
84+
<button class="bg-red-500 text-white px-3 py-1.5 rounded text-sm" (click)="verifyEmail()">
9485
Verify Email &rarr;
9586
</button>
9687
}
9788
}
9889
<hr class="opacity-30" />
9990
<h2 class="text-sm font-medium">Multi-factor Authentication</h2>
10091
@for (factor of mfaFactors(); track factor.factorId) {
101-
<div>
102-
{{ factor.factorId }} - {{ factor.displayName }}
103-
</div>
92+
<div>{{ factor.factorId }} - {{ factor.displayName }}</div>
10493
}
105-
<button
106-
class="bg-blue-500 text-white px-3 py-1.5 rounded text-sm"
107-
(click)="navigateToMfa()"
108-
>
94+
<button class="bg-blue-500 text-white px-3 py-1.5 rounded text-sm" (click)="navigateToMfa()">
10995
Add MFA Factor &rarr;
11096
</button>
11197
<hr class="opacity-30" />
112-
<button class="bg-blue-500 text-white px-3 py-1.5 rounded text-sm" (click)="signOut()">
113-
Sign Out &rarr;
114-
</button>
98+
<button class="bg-blue-500 text-white px-3 py-1.5 rounded text-sm" (click)="signOut()">Sign Out &rarr;</button>
11599
</div>
116100
</div>
117101
`,
@@ -148,12 +132,7 @@ export class AuthenticatedAppComponent {
148132
@Component({
149133
selector: "app-root",
150134
standalone: true,
151-
imports: [
152-
CommonModule,
153-
RouterModule,
154-
ThemeToggleComponent,
155-
PirateToggleComponent,
156-
],
135+
imports: [CommonModule, RouterModule, ThemeToggleComponent, PirateToggleComponent],
157136
templateUrl: "./app.component.html",
158137
})
159138
export class AppComponent {}

examples/angular/src/app/components/pirate-toggle/pirate-toggle.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,3 @@ export class PirateToggleComponent {
4949
}
5050
}
5151
}
52-

examples/angular/src/app/components/screen-route-layout/screen-route-layout.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ import { RouterModule } from "@angular/router";
3838
styles: [],
3939
})
4040
export class ScreenRouteLayoutComponent {}
41-

examples/angular/src/app/components/theme-toggle/theme-toggle.component.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ export class ThemeToggleComponent {
5757
const htmlElement = document.documentElement;
5858
const isDark = htmlElement.classList.contains("dark");
5959
htmlElement.classList.toggle("dark", !isDark);
60-
localStorage['theme'] = htmlElement.classList.contains("dark") ? "dark" : "light";
60+
localStorage["theme"] = htmlElement.classList.contains("dark") ? "dark" : "light";
6161
}
6262
}
63-

examples/angular/src/app/pirate.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,3 @@ export const pirate = registerLocale("pirate", {
9393
mfaTotpEnrollmentVerificationPrompt: "Add the code generated by yer authenticator app, arrr!",
9494
},
9595
});
96-

examples/angular/src/app/routes.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ export const routes: RouteConfig[] = [
6868
name: "Email Link Auth Screen",
6969
description: "A screen allowing a user to send an email link for sign in.",
7070
path: "/screens/email-link-auth-screen",
71-
loadComponent: () =>
72-
import("./screens/email-link-auth-screen").then((m) => m.EmailLinkAuthScreenWrapperComponent),
71+
loadComponent: () => import("./screens/email-link-auth-screen").then((m) => m.EmailLinkAuthScreenWrapperComponent),
7372
},
7473
{
7574
name: "Email Link Auth Screen (with OAuth)",
@@ -110,8 +109,7 @@ export const routes: RouteConfig[] = [
110109
name: "Phone Auth Screen (with OAuth)",
111110
description: "A screen allowing a user to sign in with a phone number, with oAuth buttons.",
112111
path: "/screens/phone-auth-screen-w-oauth",
113-
loadComponent: () =>
114-
import("./screens/phone-auth-screen-w-oauth").then((m) => m.PhoneAuthScreenWithOAuthComponent),
112+
loadComponent: () => import("./screens/phone-auth-screen-w-oauth").then((m) => m.PhoneAuthScreenWithOAuthComponent),
115113
},
116114
] as const;
117115

@@ -123,4 +121,3 @@ export const hiddenRoutes: RouteConfig[] = [
123121
loadComponent: () => import("./screens/mfa-enrollment-screen").then((m) => m.MfaEnrollmentScreenComponent),
124122
},
125123
] as const;
126-

examples/angular/src/app/screens/email-link-auth-screen-w-oauth/email-link-auth-screen-w-oauth.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ import { EmailLinkAuthScreenComponent, GoogleSignInButtonComponent } from "@inve
3030
styles: [],
3131
})
3232
export class EmailLinkAuthScreenWithOAuthComponent {}
33-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from "./email-link-auth-screen-w-oauth.component";
2-

examples/angular/src/app/screens/forgot-password-auth-screen-w-handlers/forgot-password-auth-screen-w-handlers.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,3 @@ export class ForgotPasswordAuthScreenWithHandlersComponent {
4747
this.router.navigate(["/screens/sign-up-auth-screen"]);
4848
}
4949
}
50-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export * from "./forgot-password-auth-screen-w-handlers.component";
2-

0 commit comments

Comments
 (0)