Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I tried the answer from this question. Jquery UI tab not working in AngularJS

But I tried it with my app, the div repeats itself.

This is my code,

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;

});

This is a screen shot of my actual output.

enter image description here

I am working with jQuery UI Tabs because I need it to work with IE8, Tabset from Angular Bootstrap does not work properly in IE8.

share|improve this question
    
Your code looks ok, have you tried setting the second argument of timeout to a larger value, 200 maybe? –  itd Feb 5 at 7:28
    
I just tried it, and the output is the same. –  Aaron Feb 5 at 7:34

1 Answer 1

Try adding this piece of code and see if this will work.

function recipes($scope) {
   $scope.pages = pageArray;
}
share|improve this answer
    
I am using this fiddle as an example to compare your code - jsfiddle.net/NLw6y/32 –  G-Man Feb 5 at 7:51
    
But I already have a controller. –  Aaron Feb 5 at 8:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.