Wednesday, September 17, 2014

Combining Angular.js and KendoUI

Thanks to the built-in support, using Kendo UI together with Angular.js is really easy. For all widgets you have an Angular directive available.

Here are the steps you need to take to get it up and running:

  • Include the necessary script references:
    • Either include the kendo.angular.min.js script file or use the kendo.all.min.js(which contains all widgets including the angular.js integration)
  • Add a dependency to Kendo UI inside your Angular app:
    • var productsApp = angular.module('productsApp', ['ngRoute', 'kendo.directives']);
  • Use the Kendo UI directive inside your views. A specific naming pattern is used. You even have 2 options(let’s use for example the NumericTextBox widget):
    • Option 1:  kendo-numeric-text-box
    • Option 2: kendo-numerictextbox
  • Widget options also follow a specific naming pattern. The option name is converted from camelCase to dash-separated-words, and prefixing it with k-. For example:
    • <input kendo-numerictextbox k-min="1" k-max="10" k-up-arrow-text="'Increment'" k-down-arrow-text="'Decrement'" />

More information can be found on the Kendo UI website.

No comments: