Ember-CLI routing: changed the route / pattern structure, but the assembly does not recognize the changes?

I just now changed the route structure in ember-cli and violated my application. I wanted to put my current structure one level deeper ...

Before:

Router.map(function() {
    this.resource('placements', function() {
        this.route('add');
        this.route('import');
        this.route('open');
    });
    this.route('admin');
});

After:

Router.map(function() {
    this.resource('portal', function() {
        this.resource('placements', function() {
            this.route('add');
            this.route('import');
            this.route('open');
        });
        this.route('admin');
    });
});

I also need to change the structure of the template ...

Before:

- templates/
-     placements/
-         add.hbs
-         import.hbs
-         index.hbs
-         open.hbs
-     admin.hbs
-     application.hbs
-     index.hbs
-     placements.hbs

After:

- templates/
-     portal/
-         placements/
-             add.hbs
-             import.hbs
-             index.hbs
-             open.hbs
-         admin.hbs
-         index.hbs
-         placements.hbs
-     application.hbs
-     index.hbs
-     portal.hbs

I thought I made all the changes 1 to 1, but for some reason, when I restarted the ember server, the routes of the nested "placements" are broken.

In the console log, I noticed that ember is still trying to find placements.indexunder the old templates/placements/indexand not with the new directory.

, , ? , renderTemplate hook, ... , ... , - , ?

+4
1

@Adam . .

, , , /.

, :

Router.map(function() {
    this.resource('portal', function() {
        this.resource('placements', function() {
            this.route('add');
            this.route('import');
            this.route('open');
        });
        this.route('admin');
    });
});

:

- templates/
-     placements/
-         add.hbs
-         import.hbs
-         index.hbs
-         open.hbs
-     portal/
-         admin.hbs
-         index.hbs
-     application.hbs
-     index.hbs
-     placements.hbs
-     portal.hbs

"", , , , . placements.hbs portal.hbs () ( ) .

"" {{outlet}}, "" , .

Ember-CLI , , , . , - , Ember.


:

EMBER 1.7.0

!

, .

- , , , - . , . , .

, , , REST. .

, ( ):

Router.map(function() {
    this.route('portal', function() {
        this.route('placements', function() {
            this.route('add');
            this.route('import');
            this.route('open');
        });
        this.route('admin');
    });
});

:

- templates/
-     portal/
-         placements/
-             add.hbs
-             import.hbs
-             index.hbs
-             open.hbs
-         admin.hbs
-         index.hbs
-         placements.hbs
-     application.hbs
-     index.hbs
-     portal.hbs

/,/,/ .. ..

( ) {{link-to}} transitionTo : , {{link-to 'portal.placements.index'}}.

+10

Source: https://habr.com/ru/post/1547062/


All Articles