Add Header and correction for seo service import
This commit is contained in:
parent
b70bcfbe12
commit
f923af8e5d
@ -10,14 +10,16 @@ import { AngularFireModule } from '@angular/fire';
|
||||
import { AngularFireDatabaseModule } from '@angular/fire/database';
|
||||
import { environment } from '@env/environment';
|
||||
import { GlobalErrorHandler } from '@app/core/global-error-handler/global-error-handler.service';
|
||||
import { LogService } from '@app/core/services';
|
||||
import { LogService, SEOService } from '@app/core/services';
|
||||
import { AppMaterialModule } from '@app/app-material.module';
|
||||
import { AppRoutingModule } from '@app/app-routing.module';
|
||||
import { HeaderComponent } from './header/header.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
HomeComponent,
|
||||
HeaderComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -29,6 +31,7 @@ import { AppRoutingModule } from '@app/app-routing.module';
|
||||
],
|
||||
providers: [
|
||||
LogService,
|
||||
SEOService,
|
||||
{
|
||||
provide: ErrorHandler,
|
||||
useClass: GlobalErrorHandler,
|
||||
|
@ -7,10 +7,8 @@ import { filter, map, mergeMap } from 'rxjs/operators';
|
||||
@Injectable()
|
||||
export class SEOService {
|
||||
|
||||
private defaultTitle = 'Constat à l\'amiable automatique';
|
||||
private defaultDescription = 'Notre projet consiste à aider les automobilistes en automatisant le remplissage du constat. C2A est intégré dans les' +
|
||||
'véhicules et récupère lors d’un accident les données de celui-ci (chocs, vitesse, position) pour remplir le constat. L’automobiliste obtiendra' +
|
||||
'son constat rempli sur son téléphone et après avoir apposé les signatures, le constat sera envoyé aux assureurs.';
|
||||
private defaultTitle = 'DiscoTrip';
|
||||
private defaultDescription = 'Nothing';
|
||||
private defaultNoIndex = false;
|
||||
private defaultNoFollow = false;
|
||||
|
||||
@ -47,13 +45,13 @@ export class SEOService {
|
||||
}
|
||||
|
||||
private setMetas( event: any ) {
|
||||
event[ 'title' ] = ( !event[ 'title' ] ? this.defaultTitle : event[ 'title' ] );
|
||||
event[ 'description' ] = ( !event[ 'description' ] ? this.defaultDescription : event[ 'description' ] );
|
||||
event[ 'noindex' ] = ( !event[ 'noindex' ] ? this.defaultNoIndex : event[ 'noindex' ] );
|
||||
event[ 'nofollow' ] = ( !event[ 'nofollow' ] ? this.defaultNoFollow : event[ 'nofollow' ] );
|
||||
this.updateTitle( event[ 'title' ] + ' | C2A' );
|
||||
this.updateDescription( event[ 'description' ] );
|
||||
this.updateIndexFollow( event[ 'noindex' ], event[ 'nofollow' ] );
|
||||
event.title = ( !event.title ? this.defaultTitle : event.title );
|
||||
event.description = ( !event.description ? this.defaultDescription : event.description );
|
||||
event.noindex = ( !event.noindex ? this.defaultNoIndex : event.noindex );
|
||||
event.nofollow = ( !event.nofollow ? this.defaultNoFollow : event.nofollow );
|
||||
this.updateTitle( event.title + ' | C2A' );
|
||||
this.updateDescription( event.description );
|
||||
this.updateIndexFollow( event.noindex, event.nofollow );
|
||||
}
|
||||
|
||||
private routerListener() {
|
||||
|
0
src/app/header/header.component.css
Normal file
0
src/app/header/header.component.css
Normal file
3
src/app/header/header.component.html
Normal file
3
src/app/header/header.component.html
Normal file
@ -0,0 +1,3 @@
|
||||
<p>
|
||||
header works!
|
||||
</p>
|
25
src/app/header/header.component.spec.ts
Normal file
25
src/app/header/header.component.spec.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { HeaderComponent } from './header.component';
|
||||
|
||||
describe('HeaderComponent', () => {
|
||||
let component: HeaderComponent;
|
||||
let fixture: ComponentFixture<HeaderComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ HeaderComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(HeaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
15
src/app/header/header.component.ts
Normal file
15
src/app/header/header.component.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-header',
|
||||
templateUrl: './header.component.html',
|
||||
styleUrls: ['./header.component.css']
|
||||
})
|
||||
export class HeaderComponent implements OnInit {
|
||||
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
<div>
|
||||
Welcome in our home page
|
||||
</div>
|
||||
<app-header>
|
||||
Test
|
||||
</app-header>
|
||||
|
Loading…
Reference in New Issue
Block a user