Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:51:52+00:00 2026-06-08T04:51:52+00:00

Recently I’ve been studying Ember.js for a number of upcoming projects. The documentation on

  • 0

Recently I’ve been studying Ember.js for a number of upcoming projects. The documentation on proper architecture when using the Ember.Router seems rather sparse. One thing that I’ve noticed about the router is that it seems like all views are bound to the router context instead of to their Controller or even View contexts. So action items in views require a method in the router and do not work for methods in the View or Controller objects.

Example (in coffeescript):

window.App = Ember.Application.create {

    ApplicationController = Ember.Controller.extend()
    ApplicationView = Ember.View.extend
        templateName: 'application'

    FlavorMenuController = Ember.ArrayController.extend
        ##Assume an extension of Ember.Object for a model called DrinkFlavors
        content: []
        promoted_drink_flavor: null

        init: () ->
            @_super()
            ##Assume a method actually chooses a random a drink flavor to promote
            @choosePromotedDrinkFlavor()

        optForNewPromotion: () ->
            dont_include = [ @promoted_drink_flavor ]
            @choosePromotedDrinkFlavor( dont_include )

    FlavorMenuView = Ember.View.extend
        templateName: 'flavor_menu_view'

    Router: Ember.Router.extend
        root: Ember.Route.extend
            flavorMenu: Ember.Route.extend
                route: '/'
                connectOutlets: (router, event) ->
                    router.get('applicationController').connectOutlet('flavorMenu')
}

Now if I had a template like

<script type="text/x-handlebars" data-template-name="flavor_menu_view">
    <!-- ASSUME SOME VIEW STUFF HERE MAKING UP A MENU OF FLAVORS YOU CAN ORDER -->
    <a {{action optForNewPromotion}}> Ask for another promoted Item </a>
</script>

The action optForNewPromotion will not work and will complain about there not being a route for this. If you want this to work, you have to add to the router.

So somewhere in the router path you’d need to add

optForNewPromotion: (router, event) ->
    router.get('flavorMenuController').optForNewPromotion

Or you could just move the functionality for that whole method into the router.

This seems like bad architecture to either duplicate method signatures or move traditional controller behavior into the route.

Are there any better design patterns that still make use of the Router?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:51:55+00:00Added an answer on June 8, 2026 at 4:51 am

    This post Ember.js Router Action to Controller answers the question.

    Use the {{action "foo" target="controller"}} call

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I found out that I'm using tabs incorrectly in Vim . I've been
Recently, I was asked to compile some of my Android projects, based on the
Recently I'm doing some work on RTMP streaming, that is using Flowplayer to integrate
Recently I have been dealing with windows LogonUser API. The LogonUser api returns different
recently I started using storyboard and I've the following situation: I want to set
Recently I've been doing quite the project mostly working with the DateTime class. Now,..
Recently I've been dealing with texts with mixed languages, including Chinese, English, and even
Recently I've been thinking about how to transform a complex polygon into a non-complex
Recently I've been experimenting with the use of the Func<T> class, and so far
Recently I was trying to determine the time needed to calculate a waveform using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.