Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Not able to pass data to angular component for angular 1.6.2 #15793

Closed
snr-lab opened this issue Mar 10, 2017 · 4 comments
Closed

Not able to pass data to angular component for angular 1.6.2 #15793

snr-lab opened this issue Mar 10, 2017 · 4 comments

Comments

@snr-lab
Copy link

snr-lab commented Mar 10, 2017

Whenever we are passing data using 'bindings' to angular component it is getting undefined.

This issue is reproducible for angular version 1.6.2 whereas it is working as expected for version 1.5.10. In my project I am also using angular-route and angular material (1.1.1).

Steps to reproduce:

  1. Create a component
  2. Inject the module
  3. Pass any variable to the component
  4. Do the bindings using '<'
  5. The variable is getting undefined from the component.
@frederikprijck
Copy link
Contributor

frederikprijck commented Mar 10, 2017

@snrweb This appears to be working for me: https://plnkr.co/edit/ngvCHCkw2yuSn9I46xUf?p=preview

If you think my plunkr does not reproduce your use-case correctly, please modify it to reflect your issue.

For support, please contact anyone through any of the ways mentioned at:
https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#question

@healqq
Copy link

healqq commented Mar 10, 2017

@frederikprijck
Copy link
Contributor

frederikprijck commented Mar 10, 2017

@snrweb Are you accessing the input binding in the constructor ? If so, you need to move this to the $onInit hook as mentioned in @healqq 's link.

It's possible to reset the preAssignBindingsEnabled value as to how it was in 1.5 (false) but be careful, it's going to get removed in future versions: #15782 so you're more future-proof by using the $onInit hook.

@Narretz
Copy link
Contributor

Narretz commented Mar 11, 2017

I'm pretty sure @frederikprijck and @healqq are right - please read the BC notes and change your code if necessary. If the problem still persists, please reopen issue with a demo.

@Narretz Narretz closed this as completed Mar 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants