Giter Site home page Giter Site logo

angular-writing-a-custom-directive-lab-v-000's Introduction

Writing a custom Directive

Objectives

  • Create a tabs Directive
  • Create a tab Directive
  • Inherit Directive Controller methods into child Directives
  • Make tabs clickable
  • Show clicked tabs content when clicked
  • Ensure an initial tab's content can be displayed on initialisation

Instructions

Let's create some awesome tabs that will look something like this.

First of all we need a parent tabs component. We can make this either a directive or component - it's up to you (if you want to be even more awesome, use component!).

This tabs component (or directive) should have an array of tabs in its controller, and a variable with the ID of the tab that's visible.

Let's now make a tab component, with a label property. In this component, we want to require the parent tabs controller and push the tab inside. We should also check to see if our tab is the one that is visible, and if it is, display it on the page.

Back in our tabs component, loop through the list of tabs and show the labels at the top, so we can click on them. When clicking on them, we should change the active tab that displays on the page.

Make sure to call the tabs component in index.html!

angular-writing-a-custom-directive-lab-v-000's People

Contributors

toddmotto avatar ipc103 avatar bya1305 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.