私はui-roterを使用しています。私は2つのグループのページを持っています。グループAおよびグループBである。各グループにおいて、header
およびfooter
が繰り返されるが、content
が変更される。どのように私は各グループのヘッダーとフッターを繰り返さないようにすることができますか?コードを簡単にする方法はありますか?変数を試してくださいが、それは私のためにはうまくいかなかった。ui-view AngularJs multiple views
私のindex.html
<div ui-view="header"></div>
<div ui-view="content"></div>
<div ui-view="footer"></div>
グループA
$stateProvider
.state('inicio', {
url: '/inicio',
views: {
'header': {templateUrl: 'views/header.html'},
'content': {templateUrl: 'views/inicio.html'},
'footer': {templateUrl: 'views/footer.html'}
}
});
$stateProvider
.state('seguroPersonas', {
url: '/seguroPersonas',
views: {
'header': {templateUrl: 'views/header.html'},
'content': {templateUrl: 'views/seguroPersonas.html'},
'footer': {templateUrl: 'views/footer.html'}
}
});
$stateProvider
.state('seguroEmpresas', {
url: '/seguroEmpresas',
views: {
'header': {templateUrl: 'views/header.html'},
'content': {templateUrl: 'views/seguroEmpresas.html'},
'footer': {templateUrl: 'views/footer.html'}
}
});
グループB
$stateProvider
.state('dashboard', {
url: '/dashboard',
views: {
'header': {templateUrl: 'views/dashboard/headerDashboard.html'},
'content': {templateUrl: 'views/dashboard/inicioDashboard.html'},
'footer': {templateUrl: 'views/dashboard/footerDashboard.html'}
}
});
$stateProvider
.state('clientesPotenciales', {
url: '/dashboard/clientesPotenciales',
views: {
'header': {templateUrl: 'views/dashboard/headerDashboard.html'},
'content': {templateUrl: 'views/dashboard/clientesPotenciales.html'},
'footer': {templateUrl: 'views/dashboard/footerDashboard.html'}
}
});
$stateProvider
.state('seguroEmpresas', {
url: '/seguroEmpresas',
views: {
'header': {templateUrl: 'views/dashboard/headerDashboard.html'},
'content': {templateUrl: 'views/dashboard/actualizacionDatos.html'},
'footer': {templateUrl: 'views/dashboard/footerDashboard.html'}
}
});
、私は 'フォルダを作成する必要がありますパス/ to'? 'path/to/a.html' –
' path/to'は、グループA/Bのテンプレートを含むあなたの新しいファイルが持つパスを示します。したがって、新しいファイル 'a.html'をカタログ' views'に入れた場合、パスは 'views/a.html'になります。 – pkowalcze
私はpata/toにはっきりしています。私は試しましたが、うまくいきません。これはどこから来たのですか?あらかじめ名前を付けておくべきですか? –