angular的ui-router, 公共视图的路由怎么写啊

现在有header和footer两个公共视图,现在的做法是每个路由state里都引入这两个视图, 很傻的做法, 请问有好的解决方案吗

肥皂起泡泡
浏览 356回答 1
1回答

慕仙森

$stateProvider&nbsp; &nbsp; &nbsp; .state('host', {&nbsp; &nbsp; &nbsp; &nbsp; abstract: true,&nbsp; &nbsp; &nbsp; &nbsp; template: '<header /><ui-view/> <footer/>'&nbsp; &nbsp; &nbsp; })&nbsp; &nbsp; &nbsp; .state('sub', {&nbsp; &nbsp; &nbsp; &nbsp; parent: 'host'&nbsp; &nbsp; &nbsp; &nbsp; templateUrl: 'xxxxx'&nbsp; &nbsp; &nbsp; })用abstract和parent
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript