Skip to content

liwei511/ng-clone-deep

Repository files navigation

NPM

Install

npm install ng-clone-deep --save

Use

Import the service into every component

import { Component, OnInit } from '@angular/core';
import { NgCloneDeepService } from 'ng-clone-deep';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  source = [{name: 'Tom'}, {name: 'Jerry'}];
  constructor(private cloneDeep: NgCloneDeepService) {}

  ngOnInit() {
    const sourceClone = this.cloneDeep.clone(this.source); // cloneDeep.clone()
  }
}

example

Import the module into every module where you want to use the components.

import { NgCloneDeepModule } from 'ng-clone-deep/public-api';

@NgModule({
  imports: [ NgCloneDeepModule ]
})
export class AppModule {
}
<litwak-ng-clone-deep></litwak-ng-clone-deep>

About

angular clone-deep

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published