
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.