@egjs/ngx-children-differ
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

ngx-children-differ npm version

An Angular directive that checks diff when child elements are added, removed, or changed

Quick start

Module definition

import { NgxChildrenDifferDirective } from '@egjs/ngx-children-differ'; // import
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

@NgModule({
  declarations: [
    AppComponent,
    NgxChildrenDifferDirective /* Add in declarations */
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Template

<div ngxChildrenDiffer (update)="onUpdate($event)">
  <div class="panel" *ngFor="let val of list">{{val}}</div>
</div>

Script

export class AppComponent implements OnInit {
  list: number[];

  onUpdate(diffResult: ChildrenDiffResult) {
    console.log('Result Callback : added: %o, removed: %o, changed: %o', diffResult.added, diffResult.removed, diffResult.changed);
  }
}

For the more information of result(diffResult), reference egjs-list-differ documentation.

Installing dependency

Run npm install

Build

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

Running example

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

License

@egjs/ngx-children-differ is released under the MIT license.

Copyright (c) 2019-present NAVER Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Package Sidebar

Install

npm i @egjs/ngx-children-differ

Weekly Downloads

200

Version

1.0.1

License

MIT

Unpacked Size

45.9 kB

Total Files

23

Last publish

Collaborators

  • anuu0916
  • braixen
  • ajaxpf
  • jongmoon
  • sculove
  • happyhj
  • mixed
  • netil
  • younkue
  • woodneck