# Impossibile caricare il controller in un percorso nidificato

**URL:** <https://meta.discourse.org/t/cant-load-controller-in-nested-path/195222>\
**Category:** Development\
**Created:** [28 Giugno 2021, 11:29am UTC](https://meta.discourse.org/t/cant-load-controller-in-nested-path/195222 "2021-06-28T11:29:23Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Programer-D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/programer-d/32/215194_2.png) [@Programer-D](https://meta.discourse.org/u/Programer-D)\
**Post date:** [28 Giugno 2021, 11:29am UTC](https://meta.discourse.org/t/cant-load-controller-in-nested-path/195222/1 "2021-06-28T11:29:24Z")

</div>

Voglio creare una pagina nidificata (percorso) in un plugin che ho creato io stesso, e un controller limitato all’ambito di quella specifica pagina nidificata.  
Ho usato questa pagina di emberjs come riferimento.

> **[Adding Nested Routes - Tutorial - Ember Guides](https://guides.emberjs.com/v2.14.0/tutorial/subroutes/)**
>
> Up to this point, we've generated four top level routes. 
> 
> \- An about route, that gives information on our application.
> \- A contact route, with information on how to contact the company.
> \- A rentals route, where we will allow users to browse...

```javascript
export default function () {
  this.route('root_path', {path: '/root_path'}, function () {
    this.route('test_nested', {path: '/test_nested'});
  });
}

```

Al momento  
templates/root\_path/test\_nested.hbs  
è stato caricato senza alcun problema e visualizzato correttamente nell’outlet di root\_path.hbs.

Il problema riguarda il controller corrispondente.  
Ho creato controllers/root\_path/test\_path.js.es6, ma sembra non venga caricato.  
(Ho scritto il seguente codice per testarlo)

**controllers/root\_path/test\_nested.js.es6**

```javascript
export default Ember.Controller.extend({
  test_num: 0
}

```

**templates/root\_path/test\_nested.hbs**

```plaintext
test
test_num:{{test_num}}

```

**routes/root\_path/test\_nested.js.es6**

```plaintext
Non ho scritto nulla.

```

Pensavo che il luogo in cui posizionare il controller di test\_nested fosse sbagliato. Ho provato diversi percorsi, ma nessuno funziona.  
Sarebbe utile se poteste indicarmi le impostazioni appropriate.  
Se non posso usare un controller scoped, allora vorrei usare un controller root\_path.  
(Non è una soluzione ideale, però.)

---

_[View the full topic](https://meta.discourse.org/t/cant-load-controller-in-nested-path/195222)._
