Skip to content

Commit

Permalink
feat(aurelia): make default root load relative to config module if de…
Browse files Browse the repository at this point in the history
…fined
  • Loading branch information
EisenbergEffect committed Jun 30, 2016
1 parent 6329fc9 commit 8c2334e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/aurelia.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {Container} from 'aurelia-dependency-injection';
import {Loader} from 'aurelia-loader';
import {BindingLanguage, ViewSlot, ViewResources, TemplatingEngine, CompositionTransaction} from 'aurelia-templating';
import {DOM, PLATFORM} from 'aurelia-pal';
import {relativeToFile} from 'aurelia-path';
import {FrameworkConfiguration} from './framework-configuration';

function preventActionlessFormSubmit() {
Expand Down Expand Up @@ -116,7 +117,7 @@ export class Aurelia {
* @param applicationHost The DOM object that Aurelia will attach to.
* @return Returns a Promise of the current Aurelia instance.
*/
setRoot(root: string = 'app', applicationHost: string | Element = null): Promise<Aurelia> {
setRoot(root: string = null, applicationHost: string | Element = null): Promise<Aurelia> {
let instruction = {};

if (this.root && this.root.viewModel && this.root.viewModel.router) {
Expand All @@ -130,6 +131,14 @@ export class Aurelia {
let transaction = this.container.get(CompositionTransaction);
delete transaction.initialComposition;

if (!root) {
if (this.configModuleId) {
root = relativeToFile('./app', this.configModuleId);
} else {
root = 'app';
}
}

instruction.viewModel = root;
instruction.container = instruction.childContainer = this.container;
instruction.viewSlot = this.hostSlot;
Expand Down

0 comments on commit 8c2334e

Please sign in to comment.