0

Thats the plunker as repro: http://plnkr.co/edit/aAsEiedQSrmIhL6KtGVL?p=preview

The projects tab content is initially not visible. Only when I explicitly click on the projects tab its content gets visible.

With the ui-sref="{{t.route}}" the edit/create state activation/rendering works.

Using the original select="go(t.route)" the initial selection of the project tab works but the activation of the edit/create state fails. Weird things happen when you debug the code.

How can I fix that buggy behavior?

The import code is this:

<div>
    <tabset class="tabs-left">
        <tab 
            ng-repeat="t in tabs" 
            heading="{{t.heading}}"
            ui-sref="{{t.route}}"
           /* select="go(t.route)" */

            active="t.active">
        </tab>
    </tabset>
    <div ui-view="planner"></div>
</div>
Pascal
  • 12,265
  • 25
  • 103
  • 195
  • use select="$state.go(t.route)" $state.go, inside controller do `$scope.$state = $state` – Pankaj Parkar Feb 07 '15 at 21:32
  • Have you read the AdministrationController.js? This is doing what you suggest! $scope.go = function(route){ $state.go(route); }; – Pascal Feb 07 '15 at 22:30
  • ok..you need to write on directive like tab-click and then inside that directive tou need to trigger select event inorder to select a tab, and then change route.because select attribute of tab will not fire angular content.for that you have to write directive – Pankaj Parkar Feb 07 '15 at 22:41
  • using the select together with ui-sref should actually solve the problem of the initial selection, not? why reinvent the wheel. I guess its a bootstrap angular ui problem. I will test that tomorrow with angular 1.2.x not 1.3 ;-) – Pascal Feb 08 '15 at 00:20
  • ok angular different versions are not the problem. But I found another thread having same problem but I do not understand completely the solution as code is missing: http://stackoverflow.com/questions/26575877/how-to-use-angular-ui-bootstrap-tabs-with-ui-router – Pascal Feb 08 '15 at 12:38
  • Idid played with plunkr..added ng-init function to load default route on condition basis..and change some code inside `$stateChangeSuccess` function.. take a look at this plunkr http://plnkr.co/edit/FfElgK38dZYqOqr1qiZl?p=preview and let me know its ok then i will add anwser – Pankaj Parkar Feb 08 '15 at 13:53
  • create/edit buttons do not work anymore :P – Pascal Feb 08 '15 at 14:22
  • I will try to refactor my sample to the plunker inside this SO solution: http://stackoverflow.com/questions/21891335/angular-ui-bootstrap-tabs-not-rendering-ui-view?rq=1 It works with latest angular + ui router + bootstrap tabs it just uses not multiple controller... we will see. – Pascal Feb 09 '15 at 08:11
  • Cool..one you done..you could add your answer here..so that it will help others – Pankaj Parkar Feb 09 '15 at 08:54
  • I checked now all 3 plunker in the above pasted SO link. Either the displayed url was an empty string (nothing) what I do not want or no abstract state was used then I can not have correct url, default state whatever.. I do not care anymore. Prolly I will leave bootstrap and move to zurb. I can just hope the ui router author is really doing a final sample that works for every requirement. – Pascal Feb 09 '15 at 21:53
  • I have tweaked now another sample/fiddle I found: http://plnkr.co/edit/TIuSMHln1CGbiMn9rxub?p=preview It uses an abstract state with 3 sub states each having its own URL, just what I needed.It seems its not possible to have an abstract state with an empty url thus the child url always has a pre-url before the actual child url which is actually not needed its overfluid from a user perspective. – Pascal Feb 09 '15 at 22:23
  • oh no... everything seemed fine although I get no errors it seems the html partials (tabs) do not display their individuell content :P This is HELL! OK THAT one works where I have not edited the .html files for the states: http://plnkr.co/edit/epzrcmqse1SppNiiAoAf?p=preview No go and fit it to your needs. – Pascal Feb 09 '15 at 22:31
  • Great work man..i'll look at it afterwards.. – Pankaj Parkar Feb 10 '15 at 05:20

0 Answers0