Please consider this dependencies in package.json:
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/router": "3.2.1",
"@angular/upgrade": "2.2.1"
}
I want to use the bundle version of Angulajs and when I run this command:
npm install angular
It installs angular.min.js
I want to know what is the difference between Those? Is there any way to bundle dependencies using npm and create a single file?
Another question is I know that Angular 4
has been released and when I run this command:
npm install angular
It installs angular.min.js
with version v1.6.4
so what is this file? And why it outdated?
Types of Dependency Injection in Angular There are three types of Dependency Injections in Angular, they are as follows: Constructor injection: Here, it provides the dependencies through a class constructor. Setter injection: The client uses a setter method into which the injector injects the dependency.
@Injectable() lets Angular know that a class can be used with the dependency injector. @Injectable() is not strictly required if the class has other Angular decorators on it or does not have any dependencies.
When you run npm install angular
, AngularJS (v1.x) is installed.
Which is why, when you run the command, the latest stable version of AngularJS i.e v1.6.4 is installed.
Note: Angular v1 (AngularJS) is still supported. Last stable release was 3 months ago.
Package.json
and you would notice,
"dependencies": {
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"angular-in-memory-web-api": "~0.3.0",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.8.4"
},
which should install current stable version of Angular
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With