Precision Healthcare Solutions
CLINICAL OFFICE MPAGE SUITE DEVELOPER REPORTS DESIGNER shopping_cart mail
SALES CONTACT US
Getting StartedCerner SetupDeveloper PC SetupGitHub Project TemplatesFull Page DeploymentWorkflow ComponentsComponents & DirectivesButtonConfirm DialogDate Range PickerDrop-DownEmbedded WorkflowIconInputLogOptional TitlePatient SearchPrevent ScrollRadio ButtonsRemaining Screen SpaceResize ObserverScroll BarSelectTabbed MenuTableTreeModels & ServicesAddressAllergyCerner FunctionsCode ValueConfigCustom Custom Data DMInfoDiagnosisDialogEncounterLicenseMPageOrganizationPersonPersonnelPhoneProblemReferenceUtility

Config Service

Overview

The ConfigService service is used to read a JSON configuration file for use in your project. This file offers a few standard settings but otherwise is available to customize with whatever configuration content you wish.

To use this service, you must import the service, assign it to an object, execute a data collection operation (either with the load method on this or any other MPage Developer service, or with the MPage Service executeCCL method). Finally, you need to do something with the data you have retrieved.

Import

import {Component, inject, OnInit, ...etc...} from '@angular/core';
import {ConfigService} from '@clinicaloffice/mpage-developer';

Object Assignment

Using the Angular inject command, assign the ConfigService to a new object. It is recommended that you scope your object as "protected" to allow access to your component HTML. If the service is only used in your TypeScript file, you can safely scope the service as "private".

@Component({...
...})
export class YourComponent implements OnInit {
    protected configService = inject(ConfigService);
    ....remaining code...

Load on Initialization (Full Page MPages Only)

The full page MPage template has the config service pre-loaded in the app.config.ts file as shown in the code below.

export const appConfig: ApplicationConfig = {
    providers: [
        provideBrowserGlobalErrorListeners(),
        provideZonelessChangeDetection(),
        provideRouter(routes, withHashLocation()),
        provideHttpClient(withFetch()),
        provideAppInitializer(() => {
            // Load the config.json file (if not using, remove the next two lines or the entire provideAppInitializer section.
            const configService = inject(ConfigService);
            return configService.loadConfig();
        })
    ]
};

The loadConfig() method uses the default file path of 'config.json'. When compiled, 'config.json' will reside in your main project folder, however, during development all asset files need to be saved to your project 'public' folder. You can change the path and filename of 'config.json' by specifying the new path in the loadConfig method.

The Cerner workflow component template does not automatically load the app.config.ts as the path of the config.json file is not known at the time of initialization. This is due to the component being embedded on a different path than the Cerner component framework itself.

It is still possible to use the config service in a Cerner framework component, however, you must initialize the loadConfig() method after your component has been initialized in memory. You can determine the path that your component resides in with the path input signal variable assigned in your app.ts file.

Please take special note that CORS may be an issue when accessing your config.json file from a Cerner workflow component, and you must ensure that all proper CORS settings are in place when trying to access this file.

config.json

The config.json file is initialized with values for contextRoot and domain. Both values are used by the web login if you are rending your MPage from a web browser and not within Cerner.

{
    "contextRoot": "http://sub_domain.host_name.com/discern/domain/mpages/reports",
    "domain":[
        "b1234",
        "c1234",
        "p1234"
    ]
}

The contextRoot value can be determined by running the Clinical Office: MPage Developer Setup and Configuration MPage from DA2.

The config.json file will allow you to add any content you wish. For example, if you wanted to include a license key for a commercial MPage, you could do so by simply adding a new property to the JSON file.

{
    "contextRoot": "http://sub_domain.host_name.com/discern/domain/mpages/reports",
    "domain":[
        "b1234",
        "c1234",
        "p1234"
    ],
    "licenseKey": "3242jjm4$$3jjdskkjfd994jf8k3*3dfhtgh"
}

Using Config Data

Once you have your config file loaded into memory (which is done in the full page MPage template), you need to import your config service and inject it into an object variable as described at the top of this page.

The config object inside configService can be referenced directly in your TypeScript and HTML code.

e.g.
<b>License Key:</b> {{ configService.config?.licenseKey }}

Methods / Usable Objects

config: any

This JavaScript object contains the entire contents of your configuration file after it has been loaded by the loadConfig method.

loadConfig(file: string = 'config.json'): Promise<Object>

Assigns the contents of file to the config object.

<< Prev: Code Value
Next: Custom >>
Copyright © 2026 Precision Healthcare Solutions