项目作者: bjonesy

项目描述 :
A list component that can be used to display a list of items or a list of items to be selected.
高级语言: TypeScript
项目地址: git://github.com/bjonesy/ngx-list.git
创建时间: 2019-02-16T15:48:18Z
项目社区:https://github.com/bjonesy/ngx-list

开源协议:

下载


ngx-list

A list component that can be used to display a list of items or a list of items to be selected.

This project was generated with Angular CLI version 7.2.1.

Installation

NGXS and Angular Material are a peer dependencies. They must be installed as well. npm i @angular/material @angular/cdk @angular/animations @ngxs/store.

npm i @binnovative/ngx-list

Include in a shared or core module in your app.

  1. import { CommonModule } from '@angular/common';
  2. import { NgModule } from '@angular/core';
  3. import { NgxListLibModule } from '@bi/ngx-list';
  4. @NgModule({
  5. declarations: [],
  6. imports: [CommonModule, NgxListLibModule],
  7. exports: [NgxListLibModule]
  8. })
  9. export class ExampleModule {}

Then import the SelectionListState into the NgxsModule.forRoot([SelectionListState]) module.

  1. import { CommonModule } from '@angular/common';
  2. import { NgModule } from '@angular/core';
  3. import { NgxListLibModule, SelectionListState } from '@bi/ngx-list';
  4. import { NgxsModule } from '@ngxs/store';
  5. @NgModule({
  6. declarations: [],
  7. imports: [CommonModule, NgxListLibModule, NgxsModule.forRoot([SelectionListState])]
  8. })
  9. export class ExampleModule {}

How to use

Pass in an array of list items to the ngx-list component and a theme to use.

  1. <ngx-list theme="theme" [listItems]="listItems"></ngx-list>

Options

Theme: string.

The only avaibale theme is checkbox. It displays the list items with a checkbox. Example [https://material.angular.io/components/list/overview#selection-lists]

  1. <ngx-list theme="checkbox" [listItems]="listItems"></ngx-list>

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.