I have 2 routes /main and /home. Both should show the same HTML content. Is it possible to point both the routes to the same hbs file?
How to have multiple routes for retrieving same html content
85 Views Asked by Learner At
2
There are 2 best solutions below
0
Ankush Dharkar
On
I second the suggestion by @NullVoxPopuli. (Only adding this because I can't seem to add Markdown in the comments for the answer above).
app/
┣ components/
┃ ┗ my-content.hbs (the common HTML content)
┣ routes/
┃ ┣ home.ts
┃ ┗ main.js
┣ templates/
┃ ┣ home.hbs
┃ ┣ main.hbs
┣ ...
Components make your code highly reusable.
Related Questions in EMBER.JS
- Injecting store brings "Cannot read properties of undefined" on ver5.7/5.3 with Typescript
- Inherit session token between 2 apps as long as one of them has been signed in Ember.js
- JWT authentication out-of-the-box solution for typed Ember?
- Ember.js 5.4 how to update component variable when session store is updated
- Ember.js component button may have one of a fixed listed of values, how to make it use minimum width for longest string?
- How to use frontend app within virtual host proxypass?
- Ember Js app Cannot find module 'exists-sync'
- Ember.js did-update function not tirggering
- How to re render component when the argument changes from the table component in Ember.js?
- Uncaught Error: Could not find module `@ember/application` imported from `web-app/app`
- How do i create a custom adapter method?
- Node v20.10.0 is not tested against Ember CLI on your platform
- Missing Resource Type: received resource data with a type 'events' but no schema could be found with that name
- How to define an Observer in an Ember Octane model?
- unshiftObject method is not working in ember
Related Questions in ROUTES
- No webpage was found for the web address: https://localhost:7002/Category/Add?area=Admin. Why is my URL generated like ?area=Admin instead of /Admin/
- Symfony Framework - Route cannot be found even if it is defined in Controller
- Linux Networking - Routing packets from one network interface to another
- Redirect outbound traffic to a different port
- API not fetch data with dynamic page NEXT js
- Angular title routing translation
- Slim routing in PHP-DI container
- Laravel form action not accepting $order->id but accepting hard coded value
- Express-Router Library Error: Route.post() requires a callback function but got a [object Object]
- Vercel Problem | 404: NOT_FOUND Code: NOT_FOUND
- React Routes not Rendering Components
- data transfer to ip address using osi model
- `UseRouter` Caches the Cookies should I use `redirect`
- No connection could be made because the target machine actively refused it. (localhost:80) when attempting to test routes with TestServer
- Problem in hosting React App with react-router-dom on IIS Server
Related Questions in EMBER-DATA
- Injecting store brings "Cannot read properties of undefined" on ver5.7/5.3 with Typescript
- How do i create a custom adapter method?
- Missing Resource Type: received resource data with a type 'events' but no schema could be found with that name
- unshiftObject method is not working in ember
- Ember Buffer Keyword
- How to implement dynamic filtering in Ember.js dropdowns?
- ember data 3.28 rollback after save
- EmberJS Model relationship not updating
- my data from different adapters is stored in a single model how do i store them in different models
- ValueError while using ember.create_vectorized_features on Ember dataset in Python
- Ember Data Serializer & Adapter with Supabase returns empty (Proxy { })
- Ember invoke a component function from another component in same engine parent
- Ember data store handling array of objects
- The associated data from the list does not come to the content of the Proxy object of the model
- Consume Json api format in emberjs
Related Questions in EMBER-CLI
- Ember Js app Cannot find module 'exists-sync'
- Uncaught Error: Could not find module `@ember/application` imported from `web-app/app`
- Node v20.10.0 is not tested against Ember CLI on your platform
- unshiftObject method is not working in ember
- Ember application runtime error uncaught referenceerror ember is not defined vendor.js
- How to set a a unique id to the elements of a DOM in ember.js
- How to install ember-cli 4.12.1
- moment-timezone returns undefined while using embroider compat build in ember.js
- why .pushObject method is undefined in ember
- this. Get( "object. Value") not working properly in ember.js
- Unable to run ember commands when I use ember version 2.9.1
- Ember Observers getting broken
- CSS Images in EmberJS addons
- Cannot find module './transforms/babel-plugin-convert-existence-checks-to-macros'
- Resolving sub-dependencies fails for some packages
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
It's not possible to point routes at the same hbs file, but this is what components are for
First, generating a component can be done via
ember g component my-contentthen in
app/routes/main.hbsYou could define:and then in
app/routes/home.hbsYou could define: