From dbd703a9fb864b787bc90c45fd4eb5ded7422f24 Mon Sep 17 00:00:00 2001
From: Misko Hevery
Date: Thu, 1 Aug 2013 15:53:59 -0700
Subject: docs(compile/selmulti): description for compile/selmulti error
Closes #3459
---
docs/content/error/compile/selmulti.ngdoc | 16 ++++++++++++++++
src/ng/compile.js | 2 +-
test/ng/directive/booleanAttrsSpec.js | 2 +-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/docs/content/error/compile/selmulti.ngdoc b/docs/content/error/compile/selmulti.ngdoc
index d737ca35..8154cc67 100644
--- a/docs/content/error/compile/selmulti.ngdoc
+++ b/docs/content/error/compile/selmulti.ngdoc
@@ -2,3 +2,19 @@
@name $compile:selmulti
@fullName Binding to Multiple Attribute
@description
+
+Binding to the `multiple` attribute of `select` element is not supported since switching between multiple and single mode changes the {@link api/ng.directive:ngModel `ngModel`} object type from instance to array of instances which breaks the model semantics.
+
+If you need to use different types of `select` elements in your template based on some variable, please use {@link api/ng.directive:ngIf ngIf} or {@link api/ng.directive:ngSwitch ngSwitch} directives to select one of them to be used at runtime.
+
+
+Example with invalid usage:
+```
+
+```
+
+Example that uses ngIf to pick one of the `select` elements based on a variable:
+```
+
+
+```
diff --git a/src/ng/compile.js b/src/ng/compile.js
index f2c7b381..25d48313 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -1291,7 +1291,7 @@ function $CompileProvider($provide) {
if (name === "multiple" && nodeName_(node) === "SELECT") {
- throw $compileMinErr("selmulti", "Binding to the multiple attribute is not supported. Element: {0}",
+ throw $compileMinErr("selmulti", "Binding to the 'multiple' attribute is not supported. Element: {0}",
startingTag(node));
}
diff --git a/test/ng/directive/booleanAttrsSpec.js b/test/ng/directive/booleanAttrsSpec.js
index 0b0c290d..82639051 100644
--- a/test/ng/directive/booleanAttrsSpec.js
+++ b/test/ng/directive/booleanAttrsSpec.js
@@ -93,7 +93,7 @@ describe('boolean attr directives', function() {
expect(function() {
$compile('')
- }).toThrow('[$compile:selmulti] Binding to the multiple attribute is not supported. ' +
+ }).toThrow('[$compile:selmulti] Binding to the \'multiple\' attribute is not supported. ' +
'Element: