Skip to content Skip to sidebar Skip to footer

Integrating Angular 2.0 Inside Angular 1.x - Upgrade Module

I am trying to integrate an Angular 2.0 component inside an Angular 1.x app (for playing / learning propose...) Now, I see that it can be done by looking at the Angular2 upgrade m

Solution 1:

I have done some POC work around this and here is a working approach:

The key to this is the upgradeAdaptor

import {bootstrap,UpgradeAdapter} from'angular2/angular2';
import {SomeA2Component} from'./some/path';

declarevarangular:any;

varadapter: UpgradeAdapter = newUpgradeAdapter();
angular.module('app').directive('SomeA2Component', adapter.downgradeNg2Component(MyA2Component));
adapter.bootstrap(document.body, ['app']);

I also have a working example here: http://www.syntaxsuccess.com/viewarticle/upgrading-angular-1.x-to-2.0

Post a Comment for "Integrating Angular 2.0 Inside Angular 1.x - Upgrade Module"