Wpis z mikrobloga

#angularjs #webdev

Mam problem z ui-router

Cały czas próbuje to ogarnąć ale coś nie chce iść :|

Gdy mam coś takiego:


.state(
'accounts', {
    url: 
'/panel/accounts',
    templateUrl: 
'views/accounts/index.html'
})
```Wszytko gra, ładuje treść z pliku ale gdy dodaje coś takiego:```


.state(
'accounts', {
              url: 
'/panel/accounts',
              templateUrl: 
'views/accounts/index.html',
              views: {
                  
"create_modal": {
                      templateUrl: 
'views/accounts/partials/create_modal.html'

                  }
              }
          })

Nagle już nie chce ładować widoku z views/accounts/index.html, co robię źle ?

w głównym widoku mam
  • 24
ja bym zrobił coś takiego
.state('accounts', {
url: '/panel/accounts',
templateUrl: 'views/accounts/index.html'
})
.state('accounts.modal', {
views: {
"createmodal": {
templateUrl:
'views/accounts/partials/createmodal.html'
}
}
})

wtedy w views/accounts/index.html dać i powinno działać
@login_zajety_sic: nic innego nie wymyślę już dzisiaj :)

.state('accounts', {
url: '/panel/accounts',
templateUrl: 'views/accounts/index.html'
}).state('accounts.create_modal', {
url: '/panel/accounts/modal',
templateUrl: 'views/accounts/partials/create_modal.html'
})
@login_zajety_sic:
główny state powinie być abstrakcyjny aby był tylko dostarczycielem template, tak powinno działać

.state('account', {
abstract: true,
templateUrl: "account.html"
})
.state('account.modal', {
url: "/account",
views: {
'modal': {
templateUrl: 'modal.html'
}
}
})