Transcript

Welcome to Getting Started with FlexGrid using Wijmo and Angular 2. I’m Ross Dederer, Development Relations at GrapeCity. Today we’re going to walk through how to add Wijmo FlexGrid to a new application. In this video, we’ll be using Visual Studio 2015 with Intellisense and TypeScript, but you can use command line or other editors.

First, create a new application using Visual Studio’s HTML Application with TypeScript project template. I’ll call it GettingStartedFlexGridNg2. I recommend that we remove the index.html, app.ts, and app.css files. Go to TypeScript project settings and specify CommonJS as the project module system. Next, we need to unload our project and specify that Experimental support for decorators be enabled to remove any warnings from our output.To get Angular 2 and its libraries, add a package.json file to the root of our app. Copy the contents found in the Angular 2 quickstart manual. That instructs Visual Studio to get the libraries automatically. Visual Studio will place all libraries in node_modules.

Next, we’ll configure the project structure. Add three folders: one for scripts, where we’ll place the Wijmo controls; one for styles; and one for the src folder, which will contain our component and services.Open the project in Windows File Explorer next to the Wijmo download package. Add two folders to scripts: one called vendor, and one called definitions. Definitions will describe the API of the internal modules containing the Wijmo controls. Vendors will contain the javascript code for the controls themselves. Copy the Wijmo.Angular2 interop JS file into the Vendors location from the Interop Wijmo package. Copy the d.ts ( definition ) files from interop into a newly created folder in node_modules called Wijmo. Finally, copy the base style .

Go back to Visual Studio and include everything in styles and scripts into the project. Note that we didn’t include the Wijmo folder from node_modules.

Let's configure our Default.html. To begin, let’s give it a title. Next, we need to include the Angular 2 references as described in the online manual. Add the necessary Wijmo control references as well.

We will need to do some configuring of SystemJS. You can see here, we will put our component in the src folder. Finally, we need to link to our Wijmo base css. Now we can build the app component.

Add a new typescript class and a companion template. We can remove the default html code placed here by Visual Studio.

Import a few Angular2 modules into our component. A Data Service is required to get the data, so create a new TS class and import it into our app component. We’re ready to import Wijmo FlexGrid. First, define decorators and MetaData so that the component can be placed where ever it’s called in the markup. Expose the directives to our component from Wijmo FlexGrid. Next, create a class and call the data service to load data into FlexGrid. I am going to copy some generic data into my DataSvc. Finally, bootstrap the app.

Define AppCmp as the application root component. Expose DataSvc service to it. The final step is to configure our view. Let’s copy our FlexGrid directive and assign itemsSource to our data model from our app component.Add the component placeholder to default.html and provide any additional styling for the component.