File tree Expand file tree Collapse file tree 6 files changed +23
-9
lines changed Expand file tree Collapse file tree 6 files changed +23
-9
lines changed Original file line number Diff line number Diff line change
1
+ import { AngularTOHPage } from './app.po' ;
2
+
3
+ describe ( 'angular-hero-cli App' , function ( ) {
4
+ let page : AngularTOHPage ;
5
+
6
+ beforeEach ( ( ) => {
7
+ page = new AngularTOHPage ( ) ;
8
+ } ) ;
9
+
10
+ it ( 'Title' , ( ) => {
11
+ page . navigateTo ( ) ;
12
+ expect ( page . getParagraphText ( ) ) . toEqual ( 'Top Heroes' ) ;
13
+ } ) ;
14
+ } ) ;
Original file line number Diff line number Diff line change 1
- import { Component , Inject } from '@angular/core' ;
1
+ import { Component } from '@angular/core' ;
2
+ import { Title } from '@angular/platform-browser' ;
2
3
3
- import { APP_CONFIG } from './config/app.config' ;
4
- import { IAppConfig } from './config/iapp.config' ;
4
+ import { environment } from '../environments/environment' ;
5
5
6
6
@Component ( {
7
7
selector : 'toh-app' ,
@@ -11,7 +11,7 @@ import {IAppConfig} from './config/iapp.config';
11
11
export class AppComponent {
12
12
title : string ;
13
13
14
- constructor ( @ Inject ( APP_CONFIG ) private appConfig : IAppConfig ) {
15
- this . title = this . appConfig . title ;
14
+ constructor ( private titleService : Title ) {
15
+ titleService . setTitle ( environment . title ) ;
16
16
}
17
17
}
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ export let APP_CONFIG = new OpaqueToken('app.config');
6
6
7
7
let heroesRoute = 'heroes' ;
8
8
export const AppConfig : IAppConfig = {
9
- title : 'Tour of Heroes' ,
10
9
routes : {
11
10
heroes : heroesRoute ,
12
11
heroById : heroesRoute + '/:id'
Original file line number Diff line number Diff line change 1
1
export interface IAppConfig {
2
2
routes : any ;
3
3
endpoints : any ;
4
- title : string ;
5
4
}
Original file line number Diff line number Diff line change 1
1
export const environment = {
2
- production : true
2
+ production : true ,
3
+ title : 'Tour of heroes in prod'
3
4
} ;
Original file line number Diff line number Diff line change 4
4
// The list of which env maps to which file can be found in `angular-cli.json`.
5
5
6
6
export const environment = {
7
- production : false
7
+ production : false ,
8
+ title : 'Tour of heroes in dev'
8
9
} ;
You can’t perform that action at this time.
0 commit comments