Skip to content

Instantly share code, notes, and snippets.



Created Oct 22, 2015
What would you like to do?
ng-forward ng1 migration (part 2)
import { componentAModule } from './component-a';
angular.module('app', [componentAModule]);
import { Component, Inject, bundle } from 'ng-forward';
import { ServiceA } from './service-a';
// We converted this file in part 1
// Now we have converted serviceA so we can use properly by
// adding it to our providers array (which ensures it is bundled with this component)
// We can also now reference it by object instead of string in the @Inject call
selector: 'component-a',
providers: [ServiceA]
export class ComponentA {
constructor(serviceA) { }
export default bundle('componentAModule', ComponentA).name;
(function() {
.directive('componentB', function() {
return ['serviceB', function linkFn(serviceA){}]
import { Injectable } from 'ng-forward';
export class ServiceA{ }
(function() {
.service('serviceB', function() {});
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.