Mouad Ennaciri
Mouad Ennaciri

Reputation: 1279

Angular 1/ ui-router 1 - is it recommended to pass a large object in params?

My $state.go :

this.$state.go(transfer.project, params)

where prams is an object that contains a large project object and projectId property number type.

The state :

.state({
  name: 'transfer.project',
  url: '/{projectId:int}',
  params: {
    project: null
  },
  component: 'projectTransfer'
})

And I recover the object in my component with:

this.project = this.$state.params.project

is it a good practice to spend a large object in params ? Or if you know where is the source code that this in ui-route library

Upvotes: 1

Views: 205

Answers (1)

Mike Feltman
Mike Feltman

Reputation: 5176

The object is only being passed by reference, so all that's really happening is an additional pointer is being created to it. Resource usage would be very minimal.

Upvotes: 2

Related Questions