【问题标题】:How to change templates for Angular 1.4 New Router based on dynamic params?如何根据动态参数更改 Angular 1.4 新路由器的模板?
【发布时间】:2015-08-07 20:28:48
【问题描述】:

我有以下 $router 配置

$router.config ([
      { path: '/account/profile', components: {'main' : 'accountProfile' }},
      { path: '/campaigns/:type', components: {'main' : 'campaigns' }},
      { path: '/login', components: {'main' : 'login' }},
      { path: '/', redirectTo: '/home' }
  ]);

我想根据广告系列的 :type 更改模板。

如何使用新的 Angular 路由器做到这一点?

【问题讨论】:

    标签: angularjs angularjs-new-router


    【解决方案1】:

    我认为您可以编写自己的 TemplateMapping function - line 570 并根据请求参数返回模板名称。

    【讨论】:

      猜你喜欢
      • 2022-06-18
      • 2023-03-18
      • 2021-02-25
      • 1970-01-01
      • 1970-01-01
      • 2019-10-14
      • 2022-01-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多