# copy

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

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

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

Copying specific property of state

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://angularjs-store.gitbook.io/docs/v3.0.0/api-reference/copy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
