Skip to content

Constructor Parameters

brian428 edited this page Nov 14, 2012 · 7 revisions

Back to Advanced IoC Configuration

If needed, constructor parameters can be specified for a dependency provider. These parameters will be passed into the constructor of the target object when it is created. Constructor parameters can be configured in the following way:

Deft.Injector.configure({
  contactStore: {
    className: 'MyApp.store.ContactStore',

    // Specify an array of params to pass into ContactStore constructor
    parameters: [{
      proxy: {
        type: 'ajax',
        url: '/contacts.json',
        reader: {
          type: 'json',
          root: 'contacts'
        }
      }
    }]
  }
});

Next: Factory Functions