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

No provider for UIView.PARENT_INJECT! #1

Closed
vinczedani opened this issue Aug 10, 2016 · 1 comment
Closed

No provider for UIView.PARENT_INJECT! #1

vinczedani opened this issue Aug 10, 2016 · 1 comment

Comments

@vinczedani
Copy link

vinczedani commented Aug 10, 2016

Hello,
I am trying to port my angular 1.5 application to angular 2.
In the app i use angular-ui-router, so doring the upgrade process i want to upgrade the ui router too.
I try to mirror the process from this repo, since it provides a realy good example.

However when i try to use ng1-to-ng2 in my app, it throws "No provider for UIView.PARENT_INJECT!" error.
I was searching in the sapmple app where you register the providers, but i couldn't find it. I know its not an issue with the repo, but i dont know here else i could get help.

My code snippets:
app.ts

import uiRouter from 'angular-ui-router';
....
const appDependencies = [
  uiRouter,
  'ui.router.upgrade', ..... ]
....
angular.module(name, appDependencies)

main.ts

import { uiRouterNgUpgrade } from 'ui-router-ng1-to-ng2';
uiRouterNgUpgrade.setUpgradeAdapter(upgradeAdapter);

myComponent.ts

import { UIROUTER_DIRECTIVES } from 'ui-router-ng2';
@Component({
...
  directives: [UIROUTER_DIRECTIVES],
...
constructor(@Optional() @Inject(UIView.PARENT_INJECT) view,) {
    this.state = view && view.context && view.context.name;
  }

These snipets are the same as in the sample app. However the sample app runs without error while my app crashes. I tried importing UIROUTER_PROVIDERS but with using that, it throw an error No provider for UIRouterConfig.

@vinczedani
Copy link
Author

Resolved, There was an issue with my state definitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant