Angularjs a way to toggle the tab page

Source: Internet
Author: User

tab Bar of CSS:

1. floor-tab-Li {2     float: Left;3 padding:6px 12px;4font-size:14px;5font-Weight:normal;6line-height:1.42857143;7text-Align:center;8white-Space:nowrap;9vertical-Align:middle;Ten border:1px solid #ddd; Onebackground-color: #ffffff; Aborder-radius:3px; -margin-right:10px; - color: #4c5667; the Cursor:pointer; - } -  - . tabactive { + color: #fff; -background-color: #B36A46; + border:1px solid #B36A46; A}

HTML Code

<div class= "tab" >    <ul class= "Floor-tab fix" >        <li class= "Floor-tab-li" ng-repeat= "tab in Tabs"             ng-class= "{tabactive:isactivetab (Tab.url)}"            ng-click= "onclicktab (tab)" >             {{Tab.title}}         </li>    </ul></div><div class= "Card-box" >    <div ng-include= "Currenttab" >< /div></div><script type= "Text/ng-template" id= "a.html" >        //a.html</ Script><script type= "Text/ng-template" id= "b.html" >        //b.html</script>

Javascript

//TabSelf.scope.tabs =[{title:' Heading 1 ', URL:' A.html '}, {title:' Heading 2 ', URL:' B.html '            }        ]; //Default ItemSelf.scope.currentTab = ' a.html '; Self.scope.onClickTab=function(tab) {Self.scope.currentTab=Tab.url;        }; Self.scope.isActiveTab=function(taburl) {returnTabURL = =Self.scope.currentTab; }

Note: If you change the data refresh data, let the page display that page, such as b.html; in the callback that requests the data interface, add a sentence:

Self.scope.currentTab = ' b.html ';

Angularjs a way to toggle the tab page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.