From 9c0639437607a4fcea379bbaf610600d05d8a9b7 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 8 Nov 2011 17:40:52 -0800 Subject: chore(scenario tests): make scenario tests pass again --- docs/content/cookbook/advancedform.ngdoc | 29 +++++++++++++++++++++++++---- docs/content/cookbook/form.ngdoc | 16 ++++++++++++++-- 2 files changed, 39 insertions(+), 6 deletions(-) (limited to 'docs/content/cookbook') 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); } + };