77 InjectionToken
88} from '@angular/core' ;
99import { Router , ActivatedRoute } from '@angular/router' ;
10+ import { SeoService } from '../../../services/seo.service' ;
1011import { OperatorDoc } from '../../../../operator-docs/operator.model' ;
1112import 'rxjs/add/operator/pluck' ;
1213
@@ -26,7 +27,8 @@ export class OperatorComponent implements OnInit {
2627 constructor (
2728 private _router : Router ,
2829 private _activatedRoute : ActivatedRoute ,
29- @Inject ( OPERATOR_TOKEN ) public operators : OperatorDoc [ ]
30+ @Inject ( OPERATOR_TOKEN ) public operators : OperatorDoc [ ] ,
31+ private _seo : SeoService
3032 ) { }
3133
3234 ngOnInit ( ) {
@@ -35,15 +37,15 @@ export class OperatorComponent implements OnInit {
3537 this . operators . filter (
3638 ( operator : OperatorDoc ) => operator . name === name
3739 ) [ 0 ] || this . notfound ( ) ;
40+ this . _seo . setHeaders (
41+ [ this . operator . name , this . operator . operatorType ] ,
42+ this . operator . shortDescription
43+ ? this . operator . shortDescription . description
44+ : ''
45+ ) ;
3846 } ) ;
3947 }
4048
41- notfound ( ) {
42- console . log ( 'not found' ) ;
43- this . _router . navigate ( [ '/operators' ] ) ;
44- return { } ;
45- }
46-
4749 get operatorName ( ) {
4850 return this . operator . name ;
4951 }
@@ -104,4 +106,9 @@ export class OperatorComponent implements OnInit {
104106 get additionalResources ( ) {
105107 return this . operator . additionalResources || [ ] ;
106108 }
109+
110+ private notfound ( ) {
111+ this . _router . navigate ( [ '/operators' ] ) ;
112+ return { } ;
113+ }
107114}
0 commit comments