This section explains the steps required to add Web Report Designer to an Angular application with Bold Reports® Angular package version (<= v2.2.28).
If you are using higher version of Bold Reports® Angular (>= v2.2.28), then refer Getting Started for latest version.
Before getting started with Bold Report Designer, make sure your development environment includes the following,
Angular provides the easiest way to set Angular CLI projects using Angular CLI tool. To install the CLI application globally to your machine, run the following command in Command Prompt.
npm install -g @angular/cliTo learn more about angular-cli commands refer here
To create a new Angular application run the below command in Command Prompt.
```typescript
ng new project-name
E.g : ng new reportdesignerapp
```The
ng newcommand prompts you for information about features to include in the initial app project. Add theAngular Routingto your angular application by enteringyin the prompt window then press Enter key. Now, choose theCSSstylesheet format using the arrow keys and then press Enter key. The Angular CLI installs the required Angular npm packages and other dependencies.
Bold Reporting packages are distributed in npm as @boldreports/angular-reporting-components.
To configure the web Report Designer component, change the directory to your application’s root folder.
cd project-name
E.g : cd reportdesignerappRun the below commands, to install the internal dependencies.
npm install @boldreports/angular-reporting-components --saveInstall the typings dependencies reports.all, jquery and jsrender using below commands.
npm install @boldreports/types
npm install --save-dev @types/jquery
npm install --save-dev @types/jsrenderAdd the typings jquery, jsrender and reports.all under types node in tsconfig.app.json file.
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": [
"jquery",
"jsrender",
"reports.all"
]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}Report Designer requires window.jQuery object to render the component. Import jQuery in src/polyfills.ts file as in the following code snippet.
import * as jquery from 'jquery';
window['jQuery'] = jquery;
window['$'] = jquery;Register the @boldreports/types under the typeRoots node in the tsconfig.json file.

Refer the already configured import codes in our webpack angular seed application.
Open the angular.json file from your application’s root directory.
Refer the web Report Designer component style scripts bold.reports.all.min.css and bold.reportdesigner.min.css under the styles node of projects section as in the below code example.
If you are using Angular 6 or lower version project, add the changes in
angular-cli.jsonfile.

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"reportdesignerapp": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/reportdesignerapp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reports.all.min.css",
"./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reportdesigner.min.css"
],
"scripts": [],
"es5BrowserSupport": true
},
. . .
. . .
}In the above code snippet the
materialtheme is used. You can modify the theme based on your application, refer the following syntax:./node_modules/@boldreports/javascript-reporting-controls/Content/[theme-name]/bold.reports.all.min.cssand./node_modules/@boldreports/javascript-reporting-controls/Content/[theme-name]/bold.reportdesigner.min.css
Report Designer requires the code mirror scripts and styles to edit the SQL queries and Visual Basic code functions with syntax highlighter.
Run the below command, to install the code mirror dependencies.
npm install codemirror@5.45.0Open the angular.json file from your application’s root directory and Refer the code mirror script and styles under the scripts and styles node of projects section as in the below code example.

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"reportdesignerapp": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/reportdesignerapp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reports.all.min.css",
"./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reportdesigner.min.css",
"./node_modules/codemirror/lib/codemirror.css",
"./node_modules/codemirror/addon/hint/show-hint.css"
],
"scripts": [
"./node_modules/codemirror/lib/codemirror.js",
"./node_modules/codemirror/addon/hint/show-hint.js",
"./node_modules/codemirror/addon/hint/sql-hint.js",
"./node_modules/codemirror/mode/vb/vb.js"
],
"es5BrowserSupport": true
},
. . .
. . .
}To render chart data visualization item in angular bold report designer, need to refer the following scripts in your angular application.
bold.reports.common.min.js
bold.reports.widgets.min.js
bold.report-designer-widgets.min.js
ej.chart.min.jsOpen the angular.json file from your application’s root directory.
Refer above mentioned list of scripts under the scripts node of projects section as in the below code example.
If you are using Angular 6 or lower version project, add the changes in
angular-cli.jsonfile.

{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"reportdesignerapp": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/reportdesignerapp",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reports.all.min.css",
"./node_modules/@boldreports/javascript-reporting-controls/Content/material/bold.reportdesigner.min.css",
"./node_modules/codemirror/lib/codemirror.css",
"./node_modules/codemirror/addon/hint/show-hint.css" ],
"scripts": [
"./node_modules/codemirror/lib/codemirror.js",
"./node_modules/codemirror/addon/hint/show-hint.js",
"./node_modules/codemirror/addon/hint/sql-hint.js",
"./node_modules/codemirror/mode/vb/vb.js",
"./node_modules/@boldreports/javascript-reporting-controls/Scripts/common/bold.reports.common.min.js",
"./node_modules/@boldreports/javascript-reporting-controls/Scripts/common/bold.reports.widgets.min.js",
"./node_modules/@boldreports/javascript-reporting-controls/Scripts/common/bold.report-designer-widgets.min.js",
"./node_modules/@boldreports/javascript-reporting-controls/Scripts/data-visualization/ej.chart.min.js"
],
"es5BrowserSupport": true
},
. . .
. . .
}To add the web Report Designer component refer the following steps:
Open the src/app/app.module.ts file.
Import BOLD_REPORTDESIGNER_COMPONENTS from @boldreports/angular-reporting-components/src/reportdesigner.component package as in the below code snippet.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BOLD_REPORTDESIGNER_COMPONENTS } from '@boldreports/angular-reporting-components/src/reportdesigner.component';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent,
BOLD_REPORTDESIGNER_COMPONENTS
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }Open the src/app/app.component.html file and initialize the web Report Designer.
You can replace the following code snippet in the app.component.html file.
<bold-reportdesigner id="designer" style="position: absolute;height: 550px; width: 1250px;">
</bold-reportdesigner>Open the src/app/app.component.ts and replace the below code example.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'reportdesignerapp';
public serviceUrl: string;
constructor() {
// Initialize the Report Designer properties here.
}
}If you have faced the issue
'ej' is not definedafter the above configuration in Angular CLI latest version 7, Please refer the below code snippet in your application where you have rendered Bold Reporting Components(model file) to resolve the issue.
`/// <reference types="reports.all" />`The web Report Designer requires a Web API service to process the data and file actions. You can skip this step and use our online Web API services to create, edit, and browse reports or you must create any one of the following Web API service.
To set Web API service, open the app.component.ts file and add the code snippet as in the constructor.
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'reportdesignerapp';
public serviceUrl: string;
constructor() {
this.serviceUrl = "https://demos.boldreports.com/services/api/ReportingAPI";
}
}Open the app.component.html to set ServiceUrl property of web Report Designer as in the following code snippet.
<bold-reportdesigner id="designer" [serviceUrl] = "serviceUrl" style="position: absolute;height: 550px; width: 1250px;">
</bold-reportdesigner>Go to the workspace folder (reportdesignerapp).
Launch the server by using the CLI command ng serve, with the —open option.
ng serve --openThe ng serve command launches the server and the --open option automatically opens your browser to http://localhost:4200/
