AngularJS Store
v3.0.0
v3.0.0
  • Introduction
  • Installation
  • Tutorials
    • Setup a store
    • Get the current state
    • Update the state
    • Get notified on state changes
    • Stop from receiving notifications
  • API Reference
    • NgStore
    • copy
    • dispatch
    • hook
Powered by GitBook
On this page
  1. API Reference

copy

PreviousNgStoreNextdispatch

Last updated 6 years ago

Was this helpful?

CtrlK

Was this helpful?

Get a copy of current state.

@parameters

Name

Type

Description

stateProp

string

Optional. Specific property of state.

@return

Type

Description

any

New copy of state or property of state.

Examples:

Copying the whole state

const store = new NgStore({foo: 2, bar: 1});

// { foo: 2, bar: 1 }
const stateCopy = store.copy();

Copying specific property of state

const store = new NgStore({foo: {bar: 3, baz: 4}});

// { bar: 3, baz: 4 }
const fooCopy = store.copy('foo');