Permalink
Browse files

feat(association-select): Added resource attribute (no more need for …

…a repository)
  • Loading branch information...
RWOverdijk committed Jun 9, 2016
1 parent 35c096a commit 8badedca3c1a79d8e6028dda1fba0b3d53daea19
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/component/association-select.js
@@ -1,7 +1,9 @@
import {inject} from 'aurelia-dependency-injection';
import {bindingMode, BindingEngine} from 'aurelia-binding';
import {bindable, customElement} from 'aurelia-templating';
import {EntityManager, OrmMetadata, Entity} from '../aurelia-orm';
import {EntityManager} from '../entity-manager';
import {Entity} from '../entity';
import {OrmMetadata} from '../orm-metadata';
import extend from 'extend';
@customElement('association-select')
@@ -37,6 +39,7 @@ export class AssociationSelect {
this.bindingEngine = bindingEngine;
this.entityManager = entityManager;
this.multiple = typeof element.getAttribute('multiple') === 'string';
this.element = element;
}
/**
@@ -177,6 +180,10 @@ export class AssociationSelect {
* When attached to the DOM, initialize the component.
*/
attached() {
if (!this.repository && this.element.hasAttribute('resource')) {
this.repository = this.entityManager.getRepository(this.element.getAttribute('resource'));
}
if (!this.association && !this.manyAssociation) {
this.load(this.value);

0 comments on commit 8badedc

Please sign in to comment.