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

fix(UpgradeNg1ComponentAdapter): make bindings available on $scope #8645

Merged
merged 1 commit into from May 17, 2016

Conversation

hannahhoward
Copy link
Contributor

Fixes #8631


Please check if the PR fulfills these requirements

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • [X ] Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)

See #8631

What is the new behavior?

Currently, in an upgraded ng1 component, when controller constructor or link function is called, bindings are not available on $scope. This is because both functions where called early, before bindings had been passed down by NG2.

This PR delays NG1 Directive controller instatiation where possible and pre-link function always to the ngOnInit() lifecycle hook. This way bindings are always available on $scope in both the controller and the link function.

Does this PR introduce a breaking change?

  • Yes
  • [X ] No

If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...

… controller & link function

Delays NG1 Directive controller instatiation where possible and pre-link function always
to the ngOnInit() lifecycle hook. This way bindings are always available on $scope in both
the controller and the link function.
@mhevery
Copy link
Contributor

mhevery commented May 16, 2016

Great word @hannahhoward. I have scheduled to get this merged.

@hannahhoward
Copy link
Contributor Author

awesome! I'll keep monitoring the community help list and see what I can do :)

@mhevery
Copy link
Contributor

mhevery commented May 16, 2016

@hannahhoward would you be willing to take on #6655?

@mhevery mhevery merged commit 6cdc53c into angular:master May 17, 2016
KiaraGrouwstra pushed a commit to KiaraGrouwstra/angular that referenced this pull request Jun 10, 2016
… controller & link function (angular#8645)

Delays NG1 Directive controller instatiation where possible and pre-link function always
to the ngOnInit() lifecycle hook. This way bindings are always available on $scope in both
the controller and the link function.
KiaraGrouwstra pushed a commit to KiaraGrouwstra/angular that referenced this pull request Jun 21, 2016
… controller & link function (angular#8645)

Delays NG1 Directive controller instatiation where possible and pre-link function always
to the ngOnInit() lifecycle hook. This way bindings are always available on $scope in both
the controller and the link function.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes
Projects
None yet
3 participants