Skip to content

Instantly share code, notes, and snippets.

@timkindberg
Last active May 11, 2016 16:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timkindberg/73280001a84a15370ade to your computer and use it in GitHub Desktop.
Save timkindberg/73280001a84a15370ade to your computer and use it in GitHub Desktop.
ng-forward ng1 migration (after)
import { Component, bundle } from 'ng-forward';
import { ComponentA } from './component-a';
import { ComponentB } from './component-b';
@Component({
selector: 'app',
directives: [ ComponentA, ComponentB ]
})
export class App { }
// Now that we've got all the things converted, we can move our bundle call
// to the top most level of our app. Bundle will follow all the dependencies
// via the directives and providers properties to include them all in one bundled module
let module = bundle('app.my-component', App);
// If you need to further use this portion of your app in an even bigger portion
// just repeat the process up the tree. Here is now a reference to this module.
export default module.name;
import { Component, Inject, bundle } from 'ng-forward';
import { ServiceA } from './service-a';
@Component({
selector: 'component-a',
providers: [ ServiceA ]
})
export class ComponentA { }
import { Component, Inject, bundle } from 'ng-forward';
import { ServiceB } from './service-b';
@Component({
selector: 'component-b',
providers: [ ServiceB ]
})
export class ComponentB { }
import { Injectable } from 'ng-forward';
@Injectable()
export class ServiceA{ }
import { Injectable } from 'ng-forward';
@Injectable()
export class ServiceB{ }
@prbaron
Copy link

prbaron commented May 11, 2016

Do you really need Inject and bundle imported in components ?

Where did @Inject(ServiceA) go ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment