I have been closely following the guidelines provided in this documentation and utilizing ng-cli.
In order to implement the required configuration, I created a new file named (app-config.ts):
import { OpaqueToken } from '@angular/core';
export interface AppConfig {
supportTelephoneNumber: string;
}
export let APP_CONFIG_t = new OpaqueToken('app.config');
export const APP_CONFIG: AppConfig = {
supportTelephoneNumber: '1111 111 1111'
};
Furthermore, within my app.module.ts file, the code includes:
...
@NgModule({
declarations: [
UkCurrencyPipe,
AppComponent,
HomeComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
RouterModule.forRoot(ROUTES, { useHash: true }),
MaterialModule.forRoot()
],
providers: [
{ provide: APP_CONFIG_t, useValue: APP_CONFIG },
...
To utilize this configuration, I referenced it in my app.component.ts file as shown below:
import { Component, Inject } from '@angular/core';
import { APP_CONFIG_t, AppConfig } from './app-config';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.less']
})
export class AppComponent {
constructor(@Inject(APP_CONFIG_t) public config: AppConfig) {
callSupport(): void {
window.location.href = 'tel:+' + this.config.supportTelephoneNumber;
}
}
Although everything appears to be functioning correctly when serving my app using ng serve, I do encounter these warnings in the console while running ng server:
WARNING in ./src/app/app.component.ts
40:166 export 'AppConfig' was not found in './app-config'WARNING in ./src/app/app.component.ts
40:195 export 'AppConfig' was not found in './app-config'
Can anyone shed light on what these warnings signify and whether they require any concern?
Details of My Setup
- Operating System: Mac OS X El Capitan v10.11.6
- ng-cli: v1.0.0-beta.16
- Angular: v2.0.1
- TypeScript: v2.0.2