4

I have a page where there are few tabs and I use angular+bootstrap. I use angular.bootstrap initially. Then I have another controller for showing different set of data in one of the tabs. when I try to use angular.bootstrap again, I get the error it cannot be bootstrapped twice. To make it simple, consider the following code.

    <div id="mainpage" ng-controller="mainPageController">
    <ul>

    <li id="test1"> <a href="gototest1"> GoToTest1  </li>
    <li id="test2"> <a href="gototest2"> GoToTest2 </li>

    </ul>
    </div>


<div id="gototest1"> 
this is some sample. I have another html page here which will be loaded as a tab
</div

The page for gototest1 looks like this

    <div ng-controller="gototestcontroller>
    Here comes the another widget from another controller and 
I try to use angular.boostrap here again. And I get the error because it is already bootstrapped in mainPage

    </div>

What is the best way to use angular.bootstrap here?

1
  • what do you mean with angular.bootstrap?, where is the error I cant see it Commented Sep 7, 2014 at 22:31

2 Answers 2

0

Angular bootstrap is used to manually initialize an Angular the document or an element. https://docs.angularjs.org/guide/bootstrap

Angular cannot be initialized more than once on an element. Is there a reason you don't use automatic initialization, using ng-app?

Sign up to request clarification or add additional context in comments.

Comments

0

It sounds like you could benefit from using the module ngRoute and applying the attirbute ng-view instead of trying to bootstrap twice.

https://docs.angularjs.org/api/ngRoute

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.