如何链接到特定的Angular-ui静态选项卡

德州697

我需要链接到另一个视图上的特定选项卡。我一直在研究,但是我不确定最简单的方法是什么。我正在使用angular-ui静态选项卡。选项卡中没有太多信息,所以我没有使用任何类型的模板。我目前正在使用ng-route进行路由,如果我需要添加ui-router来完成这项工作,那很好。

Home.html

<button>
    Link to Video Email Visit Tab
</button>

PatientServices.html

<tabset justified="true">
     <tab heading="Online Visit">
        <p>
            Like many other uses of the Internet these days, online visit saves you time by allowing you to receive care.
        </p>
     </tab>

     <tab heading="Video Email Visit">
          <p>
             Meet with your doctor online and get treated for almost any health issue, as long as it isn't a medical emergency.
          </p>
     </tab>
</tabset>

错误

 Error: Failed to execute 'setAttribute' on 'Element': 'dept-title-tabs"' is not a valid attribute name.
at Error (native)
at Function.n.extend.attr (http://localhost:63193/js/jquery.min.js:4:10701)
at e.attr (http://localhost:63193/js/jquery.imedica.min.js:4:1905)
at n.access (http://localhost:63193/js/jquery.min.js:3:2985)
at n.fn.extend.attr (http://localhost:63193/js/jquery.min.js:4:10224)
at $.fn.(anonymous function) (http://localhost:63193/js/jquery.imedica.min.js:1:3283)
at $.fn.(anonymous function) [as attr] (http://localhost:63193/js/jquery.imedica.min.js:2:5666)
at Object.Attributes.$set (http://localhost:63193/js/angular/angular.js:6721:28)
at http://localhost:63193/js/angular/angular.js:7770:15
at forEach (http://localhost:63193/js/angular/angular.js:330:20)

更新错误

 Error: [$compile:nonassign] Expression 'currentTab == 'email'' used with directive 'tab' is non-assignable!
 http://errors.angularjs.org/1.3.5/$compile/nonassign?p0=currentTab%20%3D%3D%20'email'&p1=tab
at http://localhost:63193/js/angular/angular.js:63:12
at parentSet (http://localhost:63193/js/angular/angular.js:7585:25)
at parentValueWatch (http://localhost:63193/js/angular/angular.js:7598:23)
at Object.regularInterceptedExpression (http://localhost:63193/js/angular/angular.js:12738:16)
at Scope.$digest (http://localhost:63193/js/angular/angular.js:14125:40)
at Scope.$apply (http://localhost:63193/js/angular/angular.js:14395:24)
at HTMLAnchorElement.<anonymous> (http://localhost:63193/js/angular/angular.js:22827:23)
at HTMLAnchorElement.n.event.dispatch (http://localhost:63193/js/jquery.min.js:3:8066)
at HTMLAnchorElement.r.handle (http://localhost:63193/js/jquery.min.js:3:4774)
马塞尔·格沃德(Marcel Gwerder)

您可以使用参数链接到特定标签,例如:

<a href="somepage?tab=email">Link to Video Email Visit Tab</a>

然后,在控制器中,您可以使用一个对象来保存每个选项卡的状态:

$scope.tabStates = {};
$scope.tabStates[$location.search().tab || 'online'] = true; //Include default as fallback

对于每个选项卡,您都需要包含active类似以下内容表达式:

<tabset justified="true">
     <tab heading="Online Visit" active="tabStates['online']">
        <p>
            Like many other uses of the Internet these days, online visit saves you time by allowing you to receive care.
        </p>
     </tab>

     <tab heading="Video Email Visit" active="tabStates['email']">
          <p>
             Meet with your doctor online and get treated for almost any health issue, as long as it isn't a medical emergency.
          </p>
     </tab>
</tabset>

不要忘记注入$location控制器。

当然,您也可以对选项卡使用route参数来获取类似yourpage/online工作方式的url,$routeParams使用代替的方式大致相同$location

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何链接到特定的Angular-ui静态选项卡

来自分类Dev

jQuery UI选项卡:从选项卡中链接到下一个/特定选项卡

来自分类Dev

jQuery UI选项卡:链接到选项卡中的下一个/特定选项卡

来自分类Dev

链接到jQuery选项卡的特定选项卡

来自分类Dev

链接到特定选项卡的Bootstrap

来自分类Dev

Angular-UI选项卡:将类添加到特定选项卡

来自分类Dev

Angular-Bootstrap UI选项卡:“删除”选项卡选项

来自分类Dev

jQuery UI选项卡,外部选项卡之间的链接仅转到选项卡一,而不管URL中的哪个选项卡锚

来自分类Dev

如何使用Bootstrap3选项卡链接到其他页面上的特定选项卡?

来自分类Dev

使用Angular UI Bootstrap在动态创建的选项卡上设置活动选项卡

来自分类Dev

Angular UI-Bootstrap选项卡:未设置活动选项卡

来自分类Dev

Angular UI-Bootstrap选项卡:未设置活动选项卡

来自分类Dev

UI网格在Angular-UI选项卡中消失

来自分类Dev

使用Angular UI / Bootstrap UI隐藏选项卡标题

来自分类Dev

单击链接到特定的引导选项卡

来自分类Dev

更改选项卡时如何获取UI Bootstrap选项卡以发送事件

来自分类Dev

如何从另一个页面链接到特定选项卡(Telerik RadTab)

来自分类Dev

jQuery UI选项卡-锚定到内部链接

来自分类Dev

jQuery UI选项卡-锚定到内部链接

来自分类Dev

如何给外部链接到引导选项卡

来自分类Dev

如何使用参数链接到SalesForce选项卡

来自分类Dev

从外部链接到Bootstrap选项卡-如何将选项卡设置为“活动”?

来自分类Dev

链接到嵌套的JQuery选项卡

来自分类Dev

Angular UI选项卡的Select事件未按预期工作

来自分类Dev

Angular UI Bootstrap选项卡+ ng-include

来自分类Dev

Angular UI-以编程方式设置活动选项卡

来自分类Dev

Angular ui-router ...显示默认选项卡

来自分类Dev

angular ui bootstrap选项卡组件:未单击选项卡处于活动状态时如何获取选项卡内容

来自分类Dev

如何卸载隐藏/无效的jQuery UI选项卡?

Related 相关文章

  1. 1

    如何链接到特定的Angular-ui静态选项卡

  2. 2

    jQuery UI选项卡:从选项卡中链接到下一个/特定选项卡

  3. 3

    jQuery UI选项卡:链接到选项卡中的下一个/特定选项卡

  4. 4

    链接到jQuery选项卡的特定选项卡

  5. 5

    链接到特定选项卡的Bootstrap

  6. 6

    Angular-UI选项卡:将类添加到特定选项卡

  7. 7

    Angular-Bootstrap UI选项卡:“删除”选项卡选项

  8. 8

    jQuery UI选项卡,外部选项卡之间的链接仅转到选项卡一,而不管URL中的哪个选项卡锚

  9. 9

    如何使用Bootstrap3选项卡链接到其他页面上的特定选项卡?

  10. 10

    使用Angular UI Bootstrap在动态创建的选项卡上设置活动选项卡

  11. 11

    Angular UI-Bootstrap选项卡:未设置活动选项卡

  12. 12

    Angular UI-Bootstrap选项卡:未设置活动选项卡

  13. 13

    UI网格在Angular-UI选项卡中消失

  14. 14

    使用Angular UI / Bootstrap UI隐藏选项卡标题

  15. 15

    单击链接到特定的引导选项卡

  16. 16

    更改选项卡时如何获取UI Bootstrap选项卡以发送事件

  17. 17

    如何从另一个页面链接到特定选项卡(Telerik RadTab)

  18. 18

    jQuery UI选项卡-锚定到内部链接

  19. 19

    jQuery UI选项卡-锚定到内部链接

  20. 20

    如何给外部链接到引导选项卡

  21. 21

    如何使用参数链接到SalesForce选项卡

  22. 22

    从外部链接到Bootstrap选项卡-如何将选项卡设置为“活动”?

  23. 23

    链接到嵌套的JQuery选项卡

  24. 24

    Angular UI选项卡的Select事件未按预期工作

  25. 25

    Angular UI Bootstrap选项卡+ ng-include

  26. 26

    Angular UI-以编程方式设置活动选项卡

  27. 27

    Angular ui-router ...显示默认选项卡

  28. 28

    angular ui bootstrap选项卡组件:未单击选项卡处于活动状态时如何获取选项卡内容

  29. 29

    如何卸载隐藏/无效的jQuery UI选项卡?

热门标签

归档