Migrate to standalone components
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
2cf473d085
commit
e4fa38e9ce
@ -1,73 +1,6 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
import { AppComponent } from './app.component';
|
||||
import { HeaderComponent } from './components/header/header.component';
|
||||
import { FooterComponent } from './components/footer/footer.component';
|
||||
import { EditorComponent } from './components/editor/editor.component';
|
||||
import { OutputComponent } from './components/output/output.component';
|
||||
import { LandingPageComponent } from './components/landing-page/landing-page.component';
|
||||
import { DocumentationComponent } from './components/documentation/documentation.component';
|
||||
import { FormComponent } from './components/form/form.component';
|
||||
import { TermsOfServiceComponent } from './components/terms-of-service/terms-of-service.component';
|
||||
import { OurStoryComponent } from './components/our-story/our-story.component';
|
||||
import { PrivacyPolicyComponent } from './components/privacy-policy/privacy-policy.component';
|
||||
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { CodeMirrorComponent } from '@sandkasten/codemirror6-editor';
|
||||
|
||||
import { HttpClient, HttpClientModule } from '@angular/common/http';
|
||||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
|
||||
import { TranslationService } from './services/translation.service';
|
||||
import { SafeHTMLPipe } from './safe-html.pipe';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HeaderComponent,
|
||||
FooterComponent,
|
||||
EditorComponent,
|
||||
OutputComponent,
|
||||
LandingPageComponent,
|
||||
DocumentationComponent,
|
||||
FormComponent,
|
||||
PrivacyPolicyComponent,
|
||||
TermsOfServiceComponent,
|
||||
OurStoryComponent,
|
||||
SafeHTMLPipe
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
// Injection des HttpClient pour notre module de traduction
|
||||
HttpClientModule,
|
||||
// Initialisation du module de traduction
|
||||
TranslateModule.forRoot({
|
||||
// Manière dont on charge les fichiers de traduction
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
// On utiilise une fonction pour charger les fichiers de traduction
|
||||
useFactory: (createTranslateLoader),
|
||||
// deps permets de savoir ce dont on a besoin pour charger les fichiers de traduction
|
||||
deps: [HttpClient]
|
||||
},
|
||||
defaultLanguage: 'fr'
|
||||
}),
|
||||
CodeMirrorComponent
|
||||
],
|
||||
providers: [TranslationService],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
export class AppModule { }
|
||||
|
||||
// On crée une fonction pour charger les fichiers de traduction
|
||||
export function createTranslateLoader(http: HttpClient) {
|
||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json'); // On charge les fichiers de traduction depuis le dossier assets/i18n
|
||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
<p>output works!</p>
|
@ -1,21 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { OutputComponent } from './output.component';
|
||||
|
||||
describe('OutputComponent', () => {
|
||||
let component: OutputComponent;
|
||||
let fixture: ComponentFixture<OutputComponent>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [OutputComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(OutputComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
@ -1,10 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-output',
|
||||
templateUrl: './output.component.html',
|
||||
styleUrls: ['./output.component.scss']
|
||||
})
|
||||
export class OutputComponent {
|
||||
|
||||
}
|
@ -1,8 +1,10 @@
|
||||
import { SafeHTMLPipe } from './safe-html.pipe';
|
||||
import { inject } from '@angular/core/testing';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
|
||||
describe('SafeHTMLPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new SafeHTMLPipe();
|
||||
it('create an instance', inject([DomSanitizer], (domSanitizer: DomSanitizer) => {
|
||||
const pipe = new SafeHTMLPipe(domSanitizer);
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
@ -1,6 +1,25 @@
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import { createTranslateLoader } from './app/app.module';
|
||||
import { importProvidersFrom } from '@angular/core';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
||||
import { withInterceptorsFromDi, provideHttpClient, HttpClient } from '@angular/common/http';
|
||||
import { ReactiveFormsModule, FormsModule } from '@angular/forms';
|
||||
import { AppRoutingModule } from './app/app-routing.module';
|
||||
import { BrowserModule, bootstrapApplication } from '@angular/platform-browser';
|
||||
import { TranslationService } from './app/services/translation.service';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [
|
||||
importProvidersFrom(BrowserModule, AppRoutingModule, ReactiveFormsModule, FormsModule,
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useFactory: (createTranslateLoader),
|
||||
deps: [HttpClient]
|
||||
},
|
||||
defaultLanguage: 'fr'
|
||||
})),
|
||||
TranslationService,
|
||||
provideHttpClient(withInterceptorsFromDi())
|
||||
]
|
||||
}).catch(console.error);
|
||||
|
Loading…
Reference in new issue