[英]Nested Views in Angular JS
我正在尝试在另一个视图中更新视图的一部分。
但是链接不断覆盖外部ng-view
如何在ng-view中更新ng-view?
该库应完全满足您的需求:
http://angular-route-segment.com
演示站点: http : //angular-route-segment.com/src/example/
它比ui-router使用起来简单得多。 示例路由配置如下所示:
$routeSegmentProvider.
when('/section1', 's1.home').
when('/section1/prefs', 's1.prefs').
when('/section1/:id', 's1.itemInfo.overview').
when('/section1/:id/edit', 's1.itemInfo.edit').
when('/section2', 's2').
segment('s1', {
templateUrl: 'templates/section1.html',
controller: MainCtrl}).
within().
segment('home', {
templateUrl: 'templates/section1/home.html'}).
segment('itemInfo', {
templateUrl: 'templates/section1/item.html',
controller: Section1ItemCtrl,
dependencies: ['id']}).
within().
segment('overview', {
templateUrl: 'templates/section1/item/overview.html'}).
segment('edit', {
templateUrl: 'templates/section1/item/edit.html'}).
up().
segment('prefs', {
templateUrl: 'templates/section1/prefs.html'}).
up().
segment('s2', {
templateUrl: 'templates/section2.html',
controller: MainCtrl});
您应该为此获得ui-router。 我相信这是允许您执行嵌套视图的唯一模块。
源代码: https : //github.com/angular-ui/ui-router
说明如何使用: https : //github.com/angular-ui/ui-router/wiki
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.