You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
switch registration to angular.module with downgradeNg2Component instead of provide ( only if you still need to use it within Angular 1 context/components )
import{Component,Input,Output,EventEmitter}from'@angular/core';import{downgradeNg2Component}from'ng-metadata/core';
@Component({selector: 'zippy',template: `...`})classZippyComponent{
@Input()closed: boolean;
@Input()title: string;
@Output()toggle=newEventEmitter<any>();}// only if you still need to use it within angular 1angular.module('myModule',[]).directive(...downgradeNg2Component(ZippyComponent));
switch registration to angular.module with downgradeNg2Provider instead of provide ( only if you still need to use it within Angular 1 context )
if step 2 was needed we need to "take it back" for angular 2 via upgradeAdapter.addProvider(ContactsService);
import{Injectable}from'@angular/core';import{downgradeNg2Provider,addProvider}from'ng-metadata/upgrade';
@Injectable()classContactsService{privateCONTACT_DATA=[...];getContacts(){returnthis.CONTACT_DATA;}getContact(id: string){returnthis.CONTACT_DATA.find(contact=>contact.id===id);}}// if you still need to use that service within Angular 1angular.module('myModule',[]).service( ...downgradeNg2Provider(ContactsService))// if you need it in angular 1 and you downgraded it, take it back also for Angular 2 addProvider(ContactsService);
The text was updated successfully, but these errors were encountered:
basically few things to implement:
upgradeAdapter singleton creation
mitigate creating upgrade adapter manually
pure ngUpgrade:
ngUpgrade+ngMetadata:
with something like
Bootstraping hybrid app
pure ngUpgrade:
ngUpgrade+ngMetadata:
Downgrading Component
pure ngUpgrade:
ngUpgrade+ngMetadata:
Upgrading Component
ngMetadata Angular 1 Component
upgraded to:
legacy
propertydowngradeNg2Component
instead ofprovide
( only if you still need to use it within Angular 1 context/components )template usage
no changes, the same for both :)
Upgrading Providers(Services)
ngMetadata Angular 1 Service
Angular 2 Service
downgradeNg2Provider
instead ofprovide
( only if you still need to use it within Angular 1 context )upgradeAdapter.addProvider(ContactsService);
The text was updated successfully, but these errors were encountered: