The angular package represents AngularJS (version 1.x), the original JavaScript-based framework released in 2010. The @angular/core package is the foundational library for Modern Angular (version 2+), a complete rewrite using TypeScript. While they share a name and some conceptual DNA, they are distinct frameworks with different architectures, lifecycles, and maintenance statuses. angular is in Long Term Support (LTS) mode and reached End of Life in 2021, while @angular/core is actively developed and serves as the basis for current enterprise applications.
Developers often encounter confusion between the angular and @angular/core packages due to their similar naming. However, they represent two different generations of web frameworks. angular is AngularJS (v1.x), while @angular/core is the heart of Modern Angular (v2+). Understanding the technical differences is critical for architectural decisions, especially when considering migration or maintenance.
angular relies on a runtime module system defined in JavaScript. You create modules and attach controllers or directives to them. The framework bootstraps manually or via ng-app.
// angular (AngularJS)
var app = angular.module('myApp', []);
app.controller('MainCtrl', function($scope) {
$scope.message = 'Hello AngularJS';
});
@angular/core uses a compile-time module system (NgModules) or standalone components. It relies on decorators and TypeScript classes to define structure. Bootstrapping is explicit and platform-specific.
// @angular/core (Modern Angular)
import { Component } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
@Component({
selector: 'app-root',
template: '<h1>Hello Modern Angular</h1>'
})
class AppComponent {}
bootstrapApplication(AppComponent);
angular separates logic into controllers and view logic into directives. Scope objects ($scope) bind the two. This often leads to scattered logic across multiple files.
// angular (AngularJS)
app.controller('UserCtrl', function($scope) {
$scope.user = { name: 'Alice' };
$scope.update = function() { /*...*/ };
});
@angular/core unifies logic and view into Components. Each component is a self-contained class with its own template, styles, and metadata. There is no $scope; instead, you use class properties.
// @angular/core (Modern Angular)
import { Component } from '@angular/core';
@Component({
selector: 'app-user',
template: '<p>{{ user.name }}</p>'
})
class UserComponent {
user = { name: 'Alice' };
update() { /*...*/ }
}
angular uses a dirty-checking digest cycle. It watches all scopes for changes during every cycle, which can become a performance bottleneck in large apps.
// angular (AngularJS)
// Two-way binding via ng-model triggers digest
<input ng-model="user.name" />
// Manual trigger if outside Angular context
$scope.$apply();
@angular/core uses Zone.js to intercept async operations and trigger change detection efficiently. Newer versions introduce Signals for fine-grained reactivity without zone reliance.
// @angular/core (Modern Angular)
// Two-way binding via [(ngModel)] or signal inputs
<input [(ngModel)]="user.name" />
// Using Signals (v16+)
import { signal } from '@angular/core';
name = signal('Alice');
angular was built for vanilla JavaScript. While you can use TypeScript with definitions, it was not designed for it. You lack type safety and modern IDE refactoring tools.
// angular (AngularJS)
// No inherent type checking
function UserService($http) {
this.getData = function() { return $http.get('/api'); };
}
@angular/core is built with TypeScript first. You get interfaces, decorators, and strict type checking out of the box. This reduces runtime errors in large codebases.
// @angular/core (Modern Angular)
// Full type safety
import { Injectable } from '@angular/core';
@Injectable({ providedIn: 'root' })
class UserService {
getData(): Promise<any> { return fetch('/api'); }
}
angular uses string-based dependency injection. You minify-safe arrays to preserve injection names during build processes.
// angular (AngularJS)
// Minification safe array annotation
app.controller('MainCtrl', ['$scope', 'UserService', function($scope, UserService) {
//...
}]);
@angular/core uses token-based injection with TypeScript constructors. The compiler handles dependency resolution, making minification safe by default.
// @angular/core (Modern Angular)
// Constructor injection
class MainComponent {
constructor(private userService: UserService) {}
}
Despite being different frameworks, they share conceptual roots. Understanding these helps when migrating legacy code.
// angular: ng-model
<input ng-model="data" />
// @angular/core: [(ngModel)]
<input [(ngModel)]="data" />
// angular: Inject via function args
function Ctrl(Service) { }
// @angular/core: Inject via constructor
class Ctrl { constructor(Service) {} }
angular uses ngMock; @angular/core uses TestBed.// angular: ngMock
inject(function($service) { /*...*/ });
// @angular/core: TestBed
TestBed.inject(Service);
| Feature | angular (AngularJS) | @angular/core (Modern) |
|---|---|---|
| Version | 1.x (Legacy) | 2+ (Active) |
| Language | JavaScript | TypeScript |
| Architecture | Scope & Controllers | Components & Services |
| Change Detection | Digest Cycle | Zone.js & Signals |
| DI | String Tokens | Class Tokens |
| Status | End of Life | Active Development |
angular is a legacy framework that revolutionized web development in 2010 but is now obsolete for new work. It suits teams maintaining older enterprise systems who cannot afford a full rewrite yet.
@angular/core is the engine of a modern platform. It suits teams building complex, scalable applications who need long-term support, performance, and type safety.
Final Thought: Do not treat these as interchangeable options. If you are starting fresh, @angular/core is the only viable choice. If you are on angular, plan a migration strategy to Modern Angular to ensure security and maintainability.
Choose angular only if you are maintaining an existing legacy application built on AngularJS (v1.x) that cannot be immediately migrated. Do not start new projects with this package as it reached End of Life in December 2021. It lacks modern performance optimizations, TypeScript integration, and security patches available in Modern Angular.
Choose @angular/core for all new projects requiring a robust, scalable framework with TypeScript support, modern tooling, and active maintenance. It is the standard for enterprise applications, offering features like standalone components, signals, and deferred loading. This package is part of the Modern Angular ecosystem and receives regular security updates and feature releases.
This package contains the legacy AngularJS (version 1.x). AngularJS support has officially ended as of January 2022. See what ending support means and read the end of life announcement.
See @angular/core for the actively supported Angular.
You can install this package either with npm or with bower.
npm install angular
Then add a <script> to your index.html:
<script src="/node_modules/angular/angular.js"></script>
Or require('angular') from your code.
bower install angular
Then add a <script> to your index.html:
<script src="/bower_components/angular/angular.js"></script>
Documentation is available on the AngularJS docs site.
The MIT License
Copyright (c) 2022 Google LLC
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.