diff options
| author | Misko Hevery | 2011-11-08 17:40:52 -0800 | 
|---|---|---|
| committer | Misko Hevery | 2011-11-14 20:31:15 -0800 | 
| commit | 9c0639437607a4fcea379bbaf610600d05d8a9b7 (patch) | |
| tree | 1ae90d93d0139f7791487fe814360904254d39cb /docs/content/cookbook/form.ngdoc | |
| parent | 085e3c611fd0cd48757702c50c67b551a00a0d38 (diff) | |
| download | angular.js-9c0639437607a4fcea379bbaf610600d05d8a9b7.tar.bz2 | |
chore(scenario tests): make scenario tests pass again
Diffstat (limited to 'docs/content/cookbook/form.ngdoc')
| -rw-r--r-- | docs/content/cookbook/form.ngdoc | 16 | 
1 files changed, 14 insertions, 2 deletions
| diff --git a/docs/content/cookbook/form.ngdoc b/docs/content/cookbook/form.ngdoc index 6cd1d83a..1b5bf32b 100644 --- a/docs/content/cookbook/form.ngdoc +++ b/docs/content/cookbook/form.ngdoc @@ -18,6 +18,18 @@ allow a user to enter data.        };        this.state = /^\w\w$/;        this.zip = /^\d\d\d\d\d$/; + +      this.addContact = function() { +         this.user.contacts.push({type:'', value:''}); +      }; + +      this.removeContact = function(contact) { +        for ( var i = 0, ii = this.user.contacts.length; i < ii; i++) { +          if (contact === this.user.contacts[i]) { +            this.user.contacts.splice(i, 1); +          } +        } +      };      }    </script>    <div ng:controller="FormController" class="example"> @@ -34,7 +46,7 @@ allow a user to enter data.             ng:pattern="zip"  required><br/><br/>      <label>Phone:</label> -    [ <a href="" ng:click="user.contacts.$add()">add</a> ] +    [ <a href="" ng:click="addContact()">add</a> ]      <div ng:repeat="contact in user.contacts">        <select ng:model="contact.type">          <option>email</option> @@ -43,7 +55,7 @@ allow a user to enter data.          <option>IM</option>        </select>        <input type="text" ng:model="contact.value" required/> -       [ <a href="" ng:click="user.contacts.$remove(contact)">X</a> ] +       [ <a href="" ng:click="removeContact(contact)">X</a> ]      </div>      <hr/>      Debug View: | 
