Getting Started

Hello and Welcome!

Installation

The library is available as npm package, so all you need to do is to run the following command:

    {{ snippets.install }}
  

This command will create a record in your `package.json` file and install the package into the npm modules folder.

Examples

Minimal Setup Example

First thing you need to do is to import the ng2-smart-table directives into your component.

    {{ snippets.require }}
  

Then register it by adding to the list of directives of your module:

    {{ snippets.directive }}
  

Now, we need to configure the table and add it into the template. The only required setting for the component to start working is a columns configuration.
Let's register settings property inside of the component where we want to have the table and configure some columns (Settings documentation):

    {{ snippets.settings }}
  

Finally let's put the ng2-smart-table component inside of the template:

    {{ snippets.template }}
  

At this step you will have a minimally configured table which should look something like this:

All functions are available by default and you don't need to configure them somehow, so you already able to add/edit/delete rows, sort or filter the table, etc.

But it feels like something is missing... Right, there is no data in the table by default. To add some, let's create an array property with a list of objects in the component. Please note that object keys are same as in the columns configuration.

    {{ snippets.array }}
  

And pass the data to the table:

    {{ snippets.dataTemplate }}
  

Now you have some data in the table:

That's it for a minimal setup, our final component should look like this, pretty simple, huh?

    Demo Source
    {{ snippets.basicFull }}
  

Full component documentation you can find here.