Last active
May 11, 2016 16:04
-
-
Save timkindberg/73280001a84a15370ade to your computer and use it in GitHub Desktop.
ng-forward ng1 migration (after)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Inject, bundle } from 'ng-forward'; | |
import { ServiceA } from './service-a'; | |
@Component({ | |
selector: 'component-a', | |
providers: [ ServiceA ] | |
}) | |
export class ComponentA { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, Inject, bundle } from 'ng-forward'; | |
import { ServiceB } from './service-b'; | |
@Component({ | |
selector: 'component-b', | |
providers: [ ServiceB ] | |
}) | |
export class ComponentB { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from 'ng-forward'; | |
@Injectable() | |
export class ServiceA{ } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from 'ng-forward'; | |
@Injectable() | |
export class ServiceB{ } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Do you really need Inject and bundle imported in components ?
Where did
@Inject(ServiceA)
go ?