diff --git a/docs/content/cookbook/advancedform.ngdoc b/docs/content/cookbook/advancedform.ngdoc index 19b8284f..e973e30f 100644 --- a/docs/content/cookbook/advancedform.ngdoc +++ b/docs/content/cookbook/advancedform.ngdoc @@ -34,7 +34,28 @@ detection, and preventing invalid form submission. save: function() { this.master = this.form; this.cancel(); + }, + + addContact: function() { + this.form.contacts.push({type:'', value:''}); + }, + + removeContact: function(contact) { + for ( var i = 0, ii = this.form.contacts.length; i < ii; i++) { + if (contact === this.form.contacts[i]) { + this.form.contacts.splice(i, 1); + } + } + }, + + isCancelDisabled: function() { + return angular.equals(this.master, this.form); + }, + + isSaveDisabled: function() { + return this.myForm.$invalid || angular.equals(this.master, this.form); } + };
| Name | Phone |
|---|---|
| {{friend.name}} | {{friend.phone}} |