
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
This adapter extends the angular2 UpgradeAdapter by support for attribute directives. The usage is similar to the standard UpgradeAdapter.
import {ngAdapter} from 'ngAdapter/build/ngAdapter';
//create your AngularJS module
let module = angular.module('MyApp', []);
//create adapter
let adapter = new ngAdapter(module);
/**
* modify your module
*/
adapter.bootstrap(document.body, ['MyApp']);
// downgrade Component & Directive
module.directive('myNg2Component', adapter.downgradeNg2Component(MyNg2Component));
module.directive('myNg2Directive', adapter.downgradeNg2Directive(MyNg2Directive));
//downgrade NgModule
@NgModule({})
class MyNg2Module {}
adapter.addNg2Module(MyNg2Module);
let moduleName = adapter.downgradeNg2Module(MyNg2Module); //'MyNg2Module'
angular.module('App').requires.push(moduleName);
//downgrade Service
module.factory('myNg2Service', adapter.downgradeNg2Provider(MyNg2Service));
upgradeAdapter.upgradeNg1Provider('myNg1Service');
@Component({
selector: 'my-ng2-component',
template: `
<span my-ng1-attribute-directive>Hello World</span>
<my-ng1-directive></my-ng1-directive>
`
})
export class AppComponent {
constructor(@Inject('myNg1Service') service: MyNg1Service) {}
}
@NgModule({
directives: [
adapter.upgradeNg1Directive('myNg1AttributeDirective'),
adapter.upgradeNg1Component('myNg1Directive'),
AppComponent
]
})
class MyNg1Module {}
//add an Angular 2 Module to the hybrid app via addNg2Module
@NgModule({
providers: [MyNg2Service]
})
class MyNg2Module {}
adapter.addNg2Module(MyNg2Module);
//add an Angular 2 service to the Angular 2 root injector
@Injectable()
class MyService {}
adapter.addProvider(MyService);
FAQs
Wrapper around ngUpgrade to extend the support to attribute directives
We found that ngadapter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.