search

Home  >  Q&A  >  body text

angular.js - How to implement tab switching in angularjs?

That’s it. When these two buttons are clicked, the response data will be loaded. If not clicked, the default first tab will be loaded.

So, how to add different controllers to these two tabs.

The problem now is that these two tabs are just one row under the table. Are there any problems with routing?


某草草某草草2784 days ago709

reply all(2)I'll reply

  • 黄舟

    黄舟2017-05-15 17:04:02

    Can be usedurl来控制两个tab是不同的controller

    ------The following was added after the subject modified the problem description-------

    What is the relationship between

    routing control and whether is a table and the next line in it?

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-15 17:04:02

    It’s good to use ng-include,

    1. ng-include可以动态引入不同的template,适合你这里的tabYou can dynamically introduce different template to suit your tab needs

    2. Every template里自己写自己的controller is fine, how simple, for example:

    tab1_template

    <p ng-controller="tab1Ctrl">
        ....
        ....
    </p>

    tab2_template

    <p ng-controller="tab2Ctrl">
        ....
        ....
    </p>

    reply
    0
  • Cancelreply