From cbca514d88222c02d12e303f6a5e22a1ba5b2e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slobodan=20Mi=C5=A1kovi=C4=87?= Date: Tue, 19 Nov 2013 11:55:52 -0800 Subject: [PATCH] Independent sub FormController do not link to parent form if `not-required` attr is defined on the (ng)form element --- src/ng/directive/form.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ng/directive/form.js b/src/ng/directive/form.js index 6f1f587e1d19..d42bd26d14ab 100644 --- a/src/ng/directive/form.js +++ b/src/ng/directive/form.js @@ -41,6 +41,11 @@ function FormController(element, attrs) { errors = form.$error = {}, controls = []; + // do not link to parent form if not-required attr is defined + if (attrs.notRequired) { + parentForm = nullFormCtrl; + } + // init state form.$name = attrs.name || attrs.ngForm; form.$dirty = false;