2
votes

Lately EmberJS changed a lot (Router, ...) and the code I have started to write less than a month ago is now broken. One of the issue I have right now is I am not able to manually bind the controller to the view.

I am using requireJS by the way...

So I used to the able to do something like this (here to define the view for my menu and the menu items), to actually get the Controller content and selected properties.

define
(
    'app/common/views/menu',
    [
        'text!app/common/templates/menu.hbs',
        'ember'
    ],
    /**
     * Menu view
     *
     * @param template
     * @returns Class
     */
    function( template )
    {
        return Ember.View.extend
        ({
            controllerBinding : 'controller.controllers.menuController',
            selectedBinding: 'controller.selected',
            template: Ember.Handlebars.compile( template ),
            NavItemView: Ember.View.extend
            ({
                tagName: 'li',
                classNameBindings: 'isActive:active'.w(),
                isActive: function()
                {
                    return this.get('item') === this.get('parentView.selected');
                }.property('item', 'parentView.selected').cacheable()
            })
        })
    }
);

It looks like 'controller.controllers.menuController' doesn't exists anymore. I have been able to find the class in the container cache 'container.cache.contoller:menu' but my view controller will still be null. I have also try App.MenuController being defined in the Application.create({})

Any idea?

On a side note, if anybody has a working example using the latest (github) EmberJS and requireJS I would be VERY interested :)

Cheers.

1

1 Answers

0
votes

Here is the latest TODOMVC Ember/require.js! :D I'll come back to answer your questions more explicitly:

https://github.com/sh4n3d4v15/ember-todos