Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style(buildElementPropertyBindings): improve error message when binding to an known property #4396

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .settings/settings.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function buildElementPropertyBindings(

// directiveTemplatePropertyNames is null for host property bindings
if (isPresent(directiveTemplatePropertyNames)) {
exMsg += ' and there are no matching directives with a corresponding property';
exMsg += ' and there are no matching directives with a corresponding property. If this is an attribute, make sure to prefix its name with \'attr.\'';
}
throw new BaseException(exMsg);
}
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/test/core/compiler/integration_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ export function main() {

PromiseWrapper.catchError(tcb.createAsync(MyComp), (e) => {
expect(e.message).toEqual(
`Can't bind to 'unknown' since it isn't a known property of the '<div>' element and there are no matching directives with a corresponding property`);
`Can't bind to 'unknown' since it isn't a known property of the '<div>' element and there are no matching directives with a corresponding property. If this is an attribute, make sure to prefix its name with \'attr.\'`);
async.done();
return null;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function main() {
builder.bindElement(el('<div/>')).bindProperty('unknownProperty', emptyExpr());
expect(() => builder.build(new DomElementSchemaRegistry(), templateCloner))
.toThrowError(
`Can't bind to 'unknownProperty' since it isn't a known property of the '<div>' element and there are no matching directives with a corresponding property`);
`Can't bind to 'unknownProperty' since it isn't a known property of the '<div>' element and there are no matching directives with a corresponding property. If this is an attribute, make sure to prefix its name with \'attr.\'`);
});

it('should allow unknown properties if a directive uses it', () => {
Expand Down Expand Up @@ -70,7 +70,7 @@ export function main() {
binder.setComponentId('someComponent');
expect(() => builder.build(new DomElementSchemaRegistry(), templateCloner))
.toThrowError(
`Can't bind to 'unknownProperty' since it isn't a known property of the '<some-custom>' element and there are no matching directives with a corresponding property`);
`Can't bind to 'unknownProperty' since it isn't a known property of the '<some-custom>' element and there are no matching directives with a corresponding property. If this is an attribute, make sure to prefix its name with \'attr.\'`);
});

});
Expand Down