-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
UpgradeAdapter sets incorrect keys in ng1 directive controller #8856
Comments
Any updates on this issue? Seems quite important to being left for this long. |
I am 92.456% sure that this has been fixed. @wawyed, are you still seeing this error with the latest version? |
So, it hasn't been fixed for the "old" dynamic version, but it works correctly for |
We are using dynamic upgrade adapter. |
So.. Is this going to get fixed? Do I need to raise a different issue? |
Yes, it is going to get fixed (on 4.x at least), but I strongly recommend to start using |
Why? Is the dynamic upgrade going to be removed? |
@wawyed, I am not sure about that (nor is it for me to decide). The reason I recommend |
…dings Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names where swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct name for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856
…dings Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names were swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct names for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856
…dings Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names were swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct names for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856
…dings Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names were swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct names for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856
…dings Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names were swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct names for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856
…dings (angular#16128) Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names were swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct names for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856 PR Close angular#16128
…dings (angular#16128) Previously, when using a different property/attribute name for an upgraded component's binding (e.g. `bindings: {propName: '<attrName'}`), the property and attribute names were swapped (e.g. using `attrName` as the property name and `propName` as the attribute name). This resulted in unexpected behavior. This commit fixes this using the correct names for properties and attributes. This only affects `upgrade/dynamic`. `upgrade/static` works correctly already. Fixes angular#8856 PR Close angular#16128
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Current behavior
If ng1 directive controller has properties bound using bindToController and if the instance variable name is different from the attribute being read, then while using it through UpgradeAdapter, the controller gets all those properties with the attribute names and not the instance variable names.
for e.g.
The when you use the directive upgraded from UpgradeAdapter, then upon inspecting the controller these show up as:
Expected/desired behavior
The values in controller should be populated in the variables first, second and third.
Here's a plunkr to reproduce/see this issue.
https://plnkr.co/edit/0FCNd7bQ9zM3jKTViD2t?p=preview
If you notice i use the upgraded directive as:
<ng1-directive [first]="'one'" [second]="'two'">
And i have printed all the controller variables in the output and they end up as:
First:
Second:
FirstValue: one
Entire Controller: {"?secondValue":"two","firstValue":"one"}
Because of this bug, directives which have such bindings (which are genuinely required in some cases) do not work as expected. And frankly this is one of the numerous bugs we are coming across while using the UpgradeAdapter, using which is a pretty frustrating experience. It definitely does not work as it's expected to as per the guide.
The text was updated successfully, but these errors were encountered: