This package has been deprecated

Author message:

this package has been deprecated

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

0.0.1 • Public • Published

ngChildrenDiffer npm version

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

Quick start

Module definition

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

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

Template

The data(list) which is used to create DOMs MUST be passed to the directive. because the directive can recognize the time when DOM will change.

<div [ngChildrenDiffer]="list" (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 ng-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 ng-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/ng-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/ng-children-differ

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

48.2 kB

Total Files

23

Last publish

Collaborators

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