Skip to content

Commit

Permalink
Add reproduction
Browse files Browse the repository at this point in the history
  • Loading branch information
amk221 committed Oct 20, 2022
1 parent f8508c0 commit 97bc7e4
Show file tree
Hide file tree
Showing 12 changed files with 2,545 additions and 1,623 deletions.
4 changes: 3 additions & 1 deletion app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ export default class Router extends EmberRouter {
rootURL = config.rootURL;
}

Router.map(function () {});
Router.map(function () {
this.mount('foo');
});
6 changes: 2 additions & 4 deletions app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{{page-title "Example"}}
<h1>Host app</h1>

{{!-- The following component displays Ember's default welcome message. --}}
<WelcomePage />
{{!-- Feel free to remove this! --}}
<LinkTo @route='foo'>Go to Foo Engine</LinkTo>

{{outlet}}
17 changes: 17 additions & 0 deletions lib/foo/addon/controllers/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Controller from '@ember/controller';
import { action } from '@ember/object';
import { inject } from '@ember/service';
import { tracked } from '@glimmer/tracking';

export default class ApplicationController extends Controller {
queryParams = ['page'];

@tracked page = 1;

@inject router;

@action
goToPage1() {
this.router.transitionTo({ queryParams: { page: 1 } });
}
}
15 changes: 15 additions & 0 deletions lib/foo/addon/engine.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Engine from 'ember-engines/engine';
import loadInitializers from 'ember-load-initializers';
import Resolver from './resolver';
import config from './config/environment';

const { modulePrefix } = config;

const Eng = Engine.extend({
modulePrefix,
Resolver,
});

loadInitializers(Eng, modulePrefix);

export default Eng;
3 changes: 3 additions & 0 deletions lib/foo/addon/resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Resolver from 'ember-resolver';

export default Resolver;
5 changes: 5 additions & 0 deletions lib/foo/addon/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import buildRoutes from 'ember-engines/routes';

export default buildRoutes(function () {
// Define your engine's route map here
});
14 changes: 14 additions & 0 deletions lib/foo/addon/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h2>Foo Engine</h2>

Click me first:

<LinkTo @route='application' @query={{hash page=2}}>Go to page 2</LinkTo>

<br />
<br />

Then click me:

<button type='button' {{on 'click' this.goToPage1}}>Go to Page 1</button>

{{outlet}}
11 changes: 11 additions & 0 deletions lib/foo/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint-env node */
'use strict';

module.exports = function (environment) {
let ENV = {
modulePrefix: 'foo',
environment,
};

return ENV;
};
16 changes: 16 additions & 0 deletions lib/foo/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-env node */
'use strict';

const EngineAddon = require('ember-engines/lib/engine-addon');

module.exports = EngineAddon.extend({
name: 'foo',

lazyLoading: Object.freeze({
enabled: false,
}),

isDevelopingAddon() {
return true;
},
});
11 changes: 11 additions & 0 deletions lib/foo/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "foo",
"keywords": [
"ember-addon",
"ember-engine"
],
"dependencies": {
"ember-cli-htmlbars": "*",
"ember-cli-babel": "*"
}
}
Loading

0 comments on commit 97bc7e4

Please sign in to comment.