Skip to content

Commit

Permalink
Changing the standalone component.
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigokamada committed Jul 10, 2024
1 parent d8e5326 commit fe49e3a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 63 deletions.
15 changes: 0 additions & 15 deletions src/app/app-routing.module.ts

This file was deleted.

28 changes: 23 additions & 5 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
import { Component } from '@angular/core';
import { NgForm } from '@angular/forms';
import { ReCaptchaV3Service } from 'ng-recaptcha';
import { Component, inject } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { FormsModule, NgForm } from '@angular/forms';
import { RECAPTCHA_V3_SITE_KEY, RecaptchaV3Module, ReCaptchaV3Service } from 'ng-recaptcha';

import { environment } from '../environments/environment';

@Component({
selector: 'app-root',
standalone: true,
imports: [
FormsModule,
RecaptchaV3Module,
RouterOutlet,
],
providers: [
ReCaptchaV3Service,
{
provide: RECAPTCHA_V3_SITE_KEY,
useValue: environment.recaptcha.siteKey,
},
],
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
styleUrl: './app.component.scss',
})
export class AppComponent {

constructor(private recaptchaV3Service: ReCaptchaV3Service) {
recaptchaV3Service = inject(ReCaptchaV3Service);

constructor() {
}

public send(form: NgForm): void {
Expand Down
13 changes: 13 additions & 0 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
provideZoneChangeDetection({
eventCoalescing: true,
}),
provideRouter(routes)
],
};
32 changes: 0 additions & 32 deletions src/app/app.module.ts

This file was deleted.

3 changes: 3 additions & 0 deletions src/app/app.routes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Routes } from '@angular/router';

export const routes: Routes = [];
16 changes: 5 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { AppComponent } from './app/app.component';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
bootstrapApplication(AppComponent, appConfig)
.catch((err) => console.error(err));

0 comments on commit fe49e3a

Please sign in to comment.