Skip to content

Instantly share code, notes, and snippets.

@timkindberg timkindberg/app.js
Last active May 11, 2016

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.