【问题标题】:jQuery UI Tab binding with Angular JS使用 Angular JS 的 jQuery UI 选项卡绑定
【发布时间】:2015-02-05 06:45:36
【问题描述】:

我尝试了这个问题的答案。 Jquery UI tab not working in AngularJS

但我用我的应用程序尝试过,div 会重复。

这是我的代码,

HTML

<html data-ng-app="recipes">
   <!--- links and sources -->
   <body data-ng-controller="recipe-controller">
      <div id="tabs" ng-tabs>
         <ul>
            <li ng-repeat="page in jPages">
                <a class="pageName" href="#{{page.id}}">{{page.name}}</a>
            </li>
         </ul>
         <div id="{{page.id}}" ng-repeat="page in jPages">
            <p>{{page.id}}</p>
         </div>
      </div>
   </body>
</html>

JS

var app = angular.module('recipes', ['ui.bootstrap', 'ngSanitize', 'timer', 'emoji', 'ngGrid', 'ngCsv', 'xeditable'])

app.directive('ngTabs', function() {
   return function(scope, elm) {
      setTimeout(function() {
        elm.tabs();
      },0);
   };
});

app.controller('recipe-controller', function ($scope, $http, $filter, $modal, $timeout, recipesFactory, config, ShoppingListsFactory, $rootScope) {
var pageArray = [
    {
    "id": "tab1",
    "name": "tab1"},
    {
    "id": "tab2",
    "name": "tab2"},
    {
    "id": "tab3",
    "name": "tab3"},
    {
    "id": "tab4",
    "name": "tab4"},
    {
    "id": "tab5",
    "name": "tab5"},
    {
    "id": "tab6",
    "name": "tab6"},
    {
    "id": "tab7",
    "name": "tab7"},
    {
    "id": "tab8",
    "name": "tab8"}
    ];
    $scope.jPages = pageArray;

});

这是我实际输出的屏幕截图。

我正在使用 jQuery UI 选项卡,因为我需要它与 IE8 一起使用,Angular Bootstrap 的 Tabset 在 IE8 中无法正常工作。

【问题讨论】:

标签: jquery angularjs jquery-ui jquery-ui-tabs


【解决方案1】:

尝试添加这段代码,看看是否可行。

function recipes($scope) {
   $scope.pages = pageArray;
}

【讨论】:

猜你喜欢
  • 2015-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多