New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@angular/upgrade

Package Overview
Dependencies
Maintainers
2
Versions
880
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@angular/upgrade

Angular - the library for easing update from v1 to v2

  • 19.1.0-next.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
36K
decreased by-54.83%
Maintainers
2
Weekly downloads
 
Created

What is @angular/upgrade?

@angular/upgrade is a library that facilitates the migration of AngularJS applications to Angular by allowing both frameworks to coexist and interoperate within the same application. It provides tools to bootstrap hybrid applications, upgrade AngularJS components to Angular, and downgrade Angular components to AngularJS.

What are @angular/upgrade's main functionalities?

Hybrid Application Bootstrapping

This feature allows you to bootstrap a hybrid application that runs both Angular and AngularJS code. The code sample demonstrates how to bootstrap an Angular module and then use the UpgradeModule to bootstrap an AngularJS application within the same document.

import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { UpgradeModule } from '@angular/upgrade/static';
import { AppModule } from './app.module';

platformBrowserDynamic().bootstrapModule(AppModule).then(platformRef => {
  const upgrade = platformRef.injector.get(UpgradeModule) as UpgradeModule;
  upgrade.bootstrap(document.body, ['angularjsApp']);
});

Upgrading AngularJS Components

This feature allows you to upgrade AngularJS components to be used in Angular. The code sample shows how to create an Angular component that wraps an AngularJS component using the UpgradeComponent class.

import { UpgradeComponent } from '@angular/upgrade/static';

@Component({
  selector: 'app-hero-detail',
  template: '<hero-detail></hero-detail>'
})
export class HeroDetailComponent extends UpgradeComponent {
  constructor(elementRef: ElementRef, injector: Injector) {
    super('heroDetail', elementRef, injector);
  }
}

Downgrading Angular Components

This feature allows you to downgrade Angular components so they can be used in AngularJS applications. The code sample demonstrates how to create an AngularJS directive that wraps an Angular component using the downgradeComponent function.

import { downgradeComponent } from '@angular/upgrade/static';
import { HeroDetailComponent } from './hero-detail.component';

angular.module('angularjsApp').directive('heroDetail', downgradeComponent({
  component: HeroDetailComponent
}));

Other packages similar to @angular/upgrade

FAQs

Package last updated on 26 Nov 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc