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
feat(compiler): detect dangling property bindings #2598
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,7 +205,7 @@ export function main() { | |
|
||
it('should repeat over nested arrays with no intermediate element', | ||
inject([TestBed, AsyncTestCompleter], (tb: TestBed, async) => { | ||
var template = '<div><template [ng-for] #item [ng-for-of]="items">' + | ||
var template = '<div><template ng-for #item [ng-for-of]="items">' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. having A property binding [ng-for] must have an expression associated with it. Could we add a test? |
||
'<div template="ng-for #subitem of item">' + | ||
'{{subitem}}-{{item.length}};' + | ||
'</div></template></div>'; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,8 +79,8 @@ export function main() { | |
'<template [ng-switch-when]="\'b\'"><li>when b1;</li></template>' + | ||
'<template [ng-switch-when]="\'a\'"><li>when a2;</li></template>' + | ||
'<template [ng-switch-when]="\'b\'"><li>when b2;</li></template>' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should be able to change this to: |
||
'<template [ng-switch-default]><li>when default1;</li></template>' + | ||
'<template [ng-switch-default]><li>when default2;</li></template>' + | ||
'<template ng-switch-default><li>when default1;</li></template>' + | ||
'<template ng-switch-default><li>when default2;</li></template>' + | ||
'</ul></div>'; | ||
|
||
tb.createView(TestComponent, {html: template}) | ||
|
@@ -108,7 +108,7 @@ export function main() { | |
'<ul [ng-switch]="switchValue">' + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here drop |
||
'<template [ng-switch-when]="when1"><li>when 1;</li></template>' + | ||
'<template [ng-switch-when]="when2"><li>when 2;</li></template>' + | ||
'<template [ng-switch-default]><li>when default;</li></template>' + | ||
'<template ng-switch-default><li>when default;</li></template>' + | ||
'</ul></div>'; | ||
|
||
tb.createView(TestComponent, {html: template}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -232,7 +232,7 @@ class CellData { | |
</tbody> | ||
<tbody template="ng-switch-when 'interpolationAttr'"> | ||
<tr template="ng-for #row of data"> | ||
<td template="ng-for #column of row" i="{{column.i}}" j="{{column.j}}"> | ||
<td template="ng-for #column of row" attr.i="{{column.i}}" attr.j="{{column.j}}"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tbosch I hope that this doesn't change the nature of this test too much - I had to modify this one as we don't support binding to non-existing properties after this change. |
||
i,j attrs | ||
</td> | ||
</tr> | ||
|
@@ -269,7 +269,7 @@ class LargetableComponent { | |
@Component({selector: 'app'}) | ||
@View({ | ||
directives: [LargetableComponent], | ||
template: `<largetable [data]='data' [benchmarkType]='benchmarkType'></largetable>` | ||
template: `<largetable [data]='data' [benchmark-type]='benchmarkType'></largetable>` | ||
}) | ||
class AppComponent { | ||
data; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this extra information? The
ProtoViewBuilder
has all binding information of the element and all of it's directives already...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tbosch I believe that we need it due to the properties re-mapping. When we bind to directives we know only about property name on the directive side, but not about the original property binding.