Giter Site home page Giter Site logo

angular-multiple-directives-lab-v-000's Introduction

Multiple Directives

Objectives

  • Describe Directive to use
  • Write further Directives using nested Controllers
  • Manipulate Controller data with more Directives
  • Clone and delete DOM nodes with Directives
  • Communicate across scopes
  • Write unit tests for all Directives

Instructions

First off, run npm install to install the dependencies for this lab.

In this repo, we've got the base of a simple contact list. In this, we've got a list of contacts that we want to show on the page and also be able to delete and add contacts.

Let's make the contacts repeat first. Make the <li> item iterate over the contacts array of objects we've got in our ContactController.

Next, we need to be able to delete the individual contacts. We've already got a function named removeContact in our controller - let's make the link for every contact call that function, passing through $index as a parameter (this is the index of each item so we know what one to delete).

Now, we need the form to work.

We need to link the form inputs up using ng-model - attach the name input to the property name in the controller and the phone number to the property phoneNumber.

We should use ng-submit on the form to handle submit events (when the user presses enter or clicks the button) - this should call a function that pushes a new contact into our array, using the name and phoneNumber values in our controller.

We also need to test that deleting works properly. Grab one of the items in the list and click on the link inside of it. Check that the list count is now 3.

angular-multiple-directives-lab-v-000's People

Contributors

ipc103 avatar toddmotto avatar aturkewi avatar sensei100 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.