Javascript 使用ngRoute angularjs创建jquery选项卡';行不通

Javascript 使用ngRoute angularjs创建jquery选项卡';行不通,javascript,angularjs,Javascript,Angularjs,我尝试在选项卡1中添加项目,然后导航到下一个选项卡,当我返回时,事情将被重置 使用angular构建jquery选项卡的最佳方法是什么?ngshow and hide没有那么友好,因为它会使视图变得复杂和混乱。我建议使用AngularUI团队编写的。您可以找到一组很棒的Twitter引导组件,包括选项卡控件 示例: <div ng-controller="TabsDemoCtrl"> <p>Select a tab by setting active binding

我尝试在选项卡1中添加项目,然后导航到下一个选项卡,当我返回时,事情将被重置

使用angular构建jquery选项卡的最佳方法是什么?ngshow and hide没有那么友好,因为它会使视图变得复杂和混乱。

我建议使用AngularUI团队编写的。您可以找到一组很棒的Twitter引导组件,包括选项卡控件

示例:

<div ng-controller="TabsDemoCtrl">
  <p>Select a tab by setting active binding to true:</p>
  <p>
    <button class="btn btn-default btn-sm" ng-click="tabs[0].active = true">Select second tab</button>
    <button class="btn btn-default btn-sm" ng-click="tabs[1].active = true">Select third tab</button>
  </p>
  <p>
    <button class="btn btn-default btn-sm" ng-click="tabs[1].disabled = ! tabs[1].disabled">Enable / Disable third tab</button>
  </p>
  <hr />

  <tabset>
    <tab heading="Static title">Static content</tab>
    <tab ng-repeat="tab in tabs" heading="{{tab.title}}" active="tab.active" disabled="tab.disabled">
      {{tab.content}}
    </tab>
    <tab select="alertMe()">
      <tab-heading>
        <i class="glyphicon glyphicon-bell"></i> Alert!
      </tab-heading>
      I've got an HTML heading, and a select callback. Pretty cool!
    </tab>
  </tabset>

  <hr />

  <tabset vertical="true" type="navType">
    <tab heading="Vertical 1">Vertical content 1</tab>
    <tab heading="Vertical 2">Vertical content 2</tab>
  </tabset>

  <hr />

  <tabset justified="true">
    <tab heading="Justified">Justified content</tab>
    <tab heading="SJ">Short Labeled Justified content</tab>
    <tab heading="Long Justified">Long Labeled Justified content</tab>
  </tabset>
</div>
实例:

var TabsDemoCtrl = function ($scope) {
  $scope.tabs = [
    { title:"Dynamic Title 1", content:"Dynamic content 1" },
    { title:"Dynamic Title 2", content:"Dynamic content 2", disabled: true }
  ];

  $scope.alertMe = function() {
    setTimeout(function() {
      alert("You've selected the alert tab!");
    });
  };

  $scope.navType = 'pills';
};