How to Modify Ember Route Class

This happens because Composer is not defined in your code. If you look at the tags-show route, you’ll see that Composer is defined at the top.

https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/routes/tags-show.js.es6#L2

However, since you’re doing this in theme script tags, you can’t use import. You’ll have to use require instead.

So, it should work if you add something like this to the top of your code

const Composer = require("discourse/models/composer");

That said, I strongly recommend that you spend a bit of time reading

and experimenting with this new way of creating themes. It’s much easier to follow examples in core that way.

5 Likes