docs(error/$compile.baddir): mention "components" in directive name error
Closes #14212
This commit is contained in:
committed by
Georgios Kalpakas
parent
e34ef23ab8
commit
f01d6f2788
@@ -1,8 +1,8 @@
|
||||
@ngdoc error
|
||||
@name $compile:baddir
|
||||
@fullName Invalid Directive Name
|
||||
@fullName Invalid Directive/Component Name
|
||||
@description
|
||||
|
||||
This error occurs when the name of a directive is not valid.
|
||||
This error occurs when the name of a directive or component is not valid.
|
||||
|
||||
Directives must start with a lowercase character and must not contain leading or trailing whitespaces.
|
||||
Directives and Components must start with a lowercase character and must not contain leading or trailing whitespaces.
|
||||
|
||||
+2
-2
@@ -928,11 +928,11 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
|
||||
function assertValidDirectiveName(name) {
|
||||
var letter = name.charAt(0);
|
||||
if (!letter || letter !== lowercase(letter)) {
|
||||
throw $compileMinErr('baddir', "Directive name '{0}' is invalid. The first character must be a lowercase letter", name);
|
||||
throw $compileMinErr('baddir', "Directive/Component name '{0}' is invalid. The first character must be a lowercase letter", name);
|
||||
}
|
||||
if (name !== name.trim()) {
|
||||
throw $compileMinErr('baddir',
|
||||
"Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
|
||||
"Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
|
||||
name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ describe('$compile', function() {
|
||||
module(function() {
|
||||
expect(function() {
|
||||
directive('BadDirectiveName', function() { });
|
||||
}).toThrowMinErr('$compile','baddir', "Directive name 'BadDirectiveName' is invalid. The first character must be a lowercase letter");
|
||||
}).toThrowMinErr('$compile','baddir', "Directive/Component name 'BadDirectiveName' is invalid. The first character must be a lowercase letter");
|
||||
});
|
||||
inject(function($compile) {});
|
||||
});
|
||||
@@ -216,7 +216,7 @@ describe('$compile', function() {
|
||||
expect(function() {
|
||||
directive(name, function() { });
|
||||
}).toThrowMinErr(
|
||||
'$compile','baddir', 'Directive name \'' + name + '\' is invalid. ' +
|
||||
'$compile','baddir', 'Directive/Component name \'' + name + '\' is invalid. ' +
|
||||
"The name should not contain leading or trailing whitespaces");
|
||||
}
|
||||
assertLeadingOrTrailingWhitespaceInDirectiveName(' leadingWhitespaceDirectiveName');
|
||||
|
||||
Reference in New Issue
Block a user