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.

hi iam using angular Ui bootstrap http://angular-ui.github.io/bootstrap/. i have two qustions

  • i follow example given in angular-ui.github.io there they use

    script src="http://angular-ui.github.io/bootstrap/ui-bootstrap-tpls-0.10.0.js"
    

    but i dont want to use CDN so i downloaded angular ui and add it to my project. how to include it into my code? ya i did adding ['ui.bootstrap'] to my angular.module it is not working untill i add above script code.

  • im using < tabset > to create two tabs contacts and group. for example user is in group tab he wants to add memebers to a existing group so if he clicks the add member button i want to navigate to contacts tab automatically.

    i thought to use document.getElementByTagName() inside my controller. will it works? and what is the Angular way to click something programmatically.

share|improve this question
add comment

2 Answers 2

up vote 0 down vote accepted

Question #1:

<script src="folder_of_js/ui-bootstrap-tpls-0.10.0.js"></script>

Question #2:

You don't use document.getElementByTagName() with AngularJS, if you want to navigate to a tab while you are in another tab's content, an example might be the following:

<tabset>
   <tab ng-repeat="tab in tabs" heading="{{tab.title}}">
      {{tab.content}}
      <button class="btn btn-default btn-sm" ng-click="tabs[2].active = true">Select third tab</button>
   </tab>
</tabset>

As you can also see in this plunker, I added a button that navigates to the third tab whenever you click it.

share|improve this answer
    
iam having it in side BootstrapMaster folder inside that lots of folders are there like demos ,src,template,docs and misc.so where i can find ui-bootsrtap-tpls-0.0.10.0.js –  user3244665 Feb 12 at 10:36
    
where is your index.html? this should be your root, then any folder inner than this should go to the source. For example, index.html is in app/ and bootstrap is in app/one/two/three then your script src should look like: <script src="one/two/three/ui-bootstrap-tpls-0.10.0.js"></script> –  anvarik Feb 12 at 10:39
add comment

The script file is probably not loaded by the browser. You have to add a script tag pointing to where the file is in your project. For example, if the script is placed in the folder /scripts/lib/:

<script src="/scripts/lib/ui-bootstrap-tpls-0.10.0.js" />

One of the golder rules of AngularJS is to never, for any reason, referrence the DOM (i.e. an HTML element) from a controller. So while document.getElementByTagName() will technically work, I would advice against it.

In angular, you really don't click things programmatically. The common way is to bind something in your HTML to a variable in the $scope, either by curly brackets ({{someVariable}}), or by directives such as ng-class, ng-bind etc. Then you change that variable in $scope, and the HTML changes to reflect that. Is there a variable in $scope which determines which tab is open? If so, you can just change that variable, and it should work automagically.

share|improve this answer
    
thanks for reply. you mean $scope.tabs what i should do with that and can you give some example code. –  user3244665 Feb 12 at 9:51
    
Look at @anvarik 's answer, he's got you covered :) –  MW. Feb 12 at 9:59
add comment

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.