1

I'm using this tutorial to lean how to migrate from Angular1 to Angular2.

At the end of the step 4 Upgrading the Phone Service,

after fix typo error,

when I want to check the running application with "npm start", I got this error :

Unknown provider: phoneProvider <- phone

You can reproduce this error by cloning my GitHub repository that contains all the steps of this tutorial:

git clone https://github.com/ltrillaud/angular-phonecat.git
git co 12866b6ba3ab82bd3fbe0a692f55bacac91040b2

I expect to have an application running in hybrid mode with Angular2 services inside an Angular1 application.

halfer
  • 19,824
  • 17
  • 99
  • 186

1 Answers1

0

The document is not so perfect, you know, what you need to do is add a declaration after the bootstrap:

upgradeAdapter.bootstrap(document.documentElement, ['phonecatApp']).ready((ref) => { let phone: Phone = ref.ng1Injector.get('phone'); });

https://github.com/angular/upgrade-builds/blob/master/src/upgrade_adapter.d.ts#L322

B.Ma
  • 839
  • 7
  • 9