Wijmo UI for the Web
AngularJS and wijtabs
Wijmo User Guide > AngularJS Directives > AngularJS and wijtabs

In this Angular getting started guide, you'll learn how to use the Tabs widget in an HTML project using HTML markup, jQuery script, and AngularJS directives.

For more complex samples that have the controller and model in separate files, see the AngularJS Directive Gallery on our web site.

  1. To create a new HTML page in your favorite text editor, add the following code and save the document with an .html extension. Notice that the <HTML> and <body> tags are different from our usual tags.
    • The <HTML> tag is marked as an Angular app with the ng-app directive, in our script, we will specify that it uses Wijmo.
    • The <body> tag is used to define the scope of the Angular controller that we create. You can use another tag such as a <div> for the scope, but for our purposes, we will use the entire body. The ng-controller directive specifies the controller to use within this scope.

    Drop down and copy markup

    Paste in your favorite text editor.
    Copy Code
    <!DOCTYPE HTML>
    <HTML ng-app="MyApp">
    <head>
    </head>
    <body ng-controller="MyController">
    </body>
    </HTML>
    
  2. Add links to the dependencies to your HTML page within the <head> tags. Find the latest dependencies in the content delivery network (CDN) file at wijmo cdn. Along with our usual references, we add two script references for Angular that must come after the jQuery references, so they are the last two lines:
    • One is for AngularJS itself.
    • The other is for Wijmo's Angular javascript integration library.

    Drop down and copy references to paste inside the head tags

    References
    Copy Code
    <!-- jQuery -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" type="text/javascript"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js" type="text/javascript"></script>
    
    <!--Theme-->
    <link href="http://cdn.wijmo.com/themes/aristo/jquery-wijmo.css" rel="stylesheet" type="text/css" />
    
    <!--Wijmo Widgets CSS-->
    <link href="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20183.140.min.css" rel="stylesheet" type="text/css" />
    
    <!-- Wijmo Scripts -->
    <script src="http://cdn.wijmo.com/jquery.wijmo-open.all.3.20183.140.min.js" type="text/javascript"></script>
    <script src="http://cdn.wijmo.com/jquery.wijmo-pro.all.3.20183.140.min.js" type="text/javascript"></script>
    
    <!-- Angular -->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
    <script src="http://cdn.wijmo.com/interop/angular.wijmo.3.20183.140.min.js"></script>
  3. Within the <head> tags, below the references, add the following script to set the app to use Wijmo, and to create a simple controller with a $scope parameter to control data context.
    Script
    Copy Code
    <script type="text/javascript">
        var app = angular.module("MyApp", ["wijmo"]);
        function MyController($scope) {}
    </script>
  4. Add the following markup within the <body> tags to create the widget. To see how this is done in jQuery without Angular, see Tabs Quick Start.
    • We use a <wij-tabs> directive to create the widget, and set a couple of options as attributes within the element:
      • We set the sortable option to true to allow the user to drag and drop the tabs.
      • We set the collapsible option to true to allow the user to collapse the selected tab by clicking it again.
    • We use nested elements in the markup to create the tabs and content.
      • Inside our wij-tabs directive, we nest an unordered list <ul> with a line item hyperlink for each tab.                    
      • We use a <div> element with an id attribute referencing the tab linked in the <ul> to create content for each tab.
    Markup
    Copy Code
    <wij-tabs id="tabs" sortable="true" collapsible="true">
         <ul><li><a href="#tabs-1">Blippity Fling-Flang</a> </li>
              <li><a href="#tabs-2">Blipnoodle</a> </li></ul>
         <div id="tabs-1">
              <p>Ho ha a doof cringlezowee bloo bing a dizzle flop yap dizzlenizzle zap boo flungwhack shnizzlegobble ho a blop bing bangflib yap boo weeble. Boo wacko ho dabba Ongle Fling ha bing ho wow a flap-boo-plop jingle funkzonk ho blatwiddle, nip dinglezoom duh dabba Shnizzlegobble blip, shnizzlegobble blip, wuggle ho zong bang flungwhack Razzbleeb. Wugglewheezer shnozingle dang blingdoof meep boo flong, flubzongle zap shnozzleflip, flubzongle yap wibblezowee (dazzleshnaz dazzle bla boo bang). <a href="http://bff.orangehairedboy.com/">Blippity Fling-Flang by orangehairedboy</a></p>
         </div>
         <div id="tabs-2">
              <p>Zip abracadabra bananaramaflup. Zip flunging dang boo bang yip zangle. Loo flupping funky zunkity roo tizzle boo twiddling flungfloo. Flobble jingle ting nip nizzle bleep dang yip zingle. "Duh zonk ho?" razz Tony Soprano. Miss Beasley zap blang loo zonk dingely dilznoofustwiddle. "Ho izzle dee?" bloo You. Blap ho flipping meepwow.</p>
         </div>
    </wij-tabs>
  5. Save your HTML file and open it in a browser. The widget appears like the following live widget.
    MISSING WIDGET TYPE: The "Live Widget" Widget Type could not be found. The "Live Widget" Widget Type may have been deleted since this Widget was created.
See Also

Reference

Widgets