Lib: https://github.com/angular-ui/ui-router

 

使用实例:

// Some state name examples

// stateName can be a single top-level name (must be unique).
$stateProvider.state("home", {});

// Or it can be a nested state name. This state is a child of the 
// above "home" state.
$stateProvider.state("home.newest", {});

// Nest states as deeply as needed.
$stateProvider.state("home.newest.abc.xyz.inception", {});

// state() returns $stateProvider, so you can chain state declarations.
$stateProvider
  .state("home", {})
  .state("about", {})
  .state("contacts", {});

 

参数化配置:

var urls = ['news-1' ,'news-2', 'news-3'];

      angular.forEach(urls, function(v) {
        $stateProvider
          .state(v, {
            url: '/' + v,
            views: {
              'aboutBody': { templateUrl: templateBasePath + v }
            }
          });
      });

 

 

若有疑问,请发表评论或添加微信为你解答:

AngularJs $stateProvider 链表循环追加实现参数化

相关文章:

  • 2021-04-25
  • 2021-06-08
  • 2022-12-23
  • 2021-11-02
  • 2022-12-23
  • 2022-03-04
  • 2021-08-09
  • 2021-07-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案