Angular 5 UI Components Documentation
Angular UI Components for jQWidgets
Angular is a development platform for building mobile and desktop web applications. It provides a way to build apps for any deployment target by reusing existing code. Using HTML as the template language, Angular offers developers the possiblity to create their own components.
Node.js - to verify that you have it installed, run the command node -v in cmd. It will output the current version.
Note: Make sure that you are running on the latest Node.js and npm versions.
Setup using create-jqwidgets-angular-app
To use a template project with jQWidgets and Angular CLI, please refer to: create-jqwidgets-angular-app
This is the simplest way to get jQWidgets working with Angular.
Setup using Angular CLI
To use the Angular Components with Angular CLI, please refer to: Angular CLI
Setup using AOT Webpack Compilation
- Create your project folder structure
- Configurate and install all required packages
- Build the app
Step 1 - Create your root project folder
The root folder contains a few configuration files and the app folder which holds the main content of the application.
/root /app /index.html /src /app.component.ts /app.module.ts /main.ts /package.json /tsconfig.json /webpack.config.js
Note: Structure may vary based on your application needs.
Step 2 - Install and configurate all required packages
Let's take a look at the config files:
- ngc compiles our .ts files to .js. It is a drop-in replacement for tsc.
- webpack gets the transpiled .js files and bundles them to a single .js file.
When we type npm start in our CLI it executes both the commands. We just need to include the bundled file in or HTML and run it.
What's really new is the ngc section called angularCompilerOptions. Here we say to the compiler to skip generating metadata files. We have also set genDir which means all of our recompiled files will go in that folder. For more information about AOT please refer to the official Ahead-Of-Time Compilation CookBook.
For more information about Webpack please refer to the official guide.
Step 3 - Build the app
Add the needed references and the <app-root></app-root> tag to the body of index.html.
That's the tag where we initialize the main component.
Then import the bundled file we received after running the npm start command.
In the above example we create the widget through attributes.
There is another way through method called createComponent. It takes just one argument - an object containing the settings for the widget.
Now install the packages with
npm install and execute the command
npm start. A file named
main.bundle.js will appear in the app folder. Finally open
Note: We also recommend you to look at the Angular CLI tutorial.
Events Methods & Properties
The only thing you need to do is to put
II. Methods & Properties
Every widget also have a method setOptions which accepts an object as an argument. This object contains widget settings.
Two Way Data Binding
We often want to both display a data property and update that property when the user makes changes.
Let's take a look at the following example:
If you are using any of the Input based widgets like jqxInput, jqxComplexInput, jqxDateTimeInput and so on you must import the FormsModule in your app.module.ts file and add it to the @NgModel imports: