Angular 4 | Introduction (original) (raw)
Last Updated : 05 Dec, 2019
Angular 4 was released 5 years after the official release of AngularJS. Between these two versions, Angular 2 was introduced which was a complete re-write of AngularJS. The ‘MVC’ architecture of AngularJS was discarded a new ‘service-controller’ architecture was introduced in Angular 2. After Angular 2 came Angular 4 which was much more efficient than its predecessor. However, the architecture used in both the versions was the same and thus upgrading the project from v2 to v4 was comparatively easier, than upgrading from JS to v2.
Angular 3 was skipped because the router package was already in version 3.3.0. To avoid any further glitches, the team decided to skip v3.x and upgrade all the other modules directly to v4.0. The angular 4 initially release in March 2017.
Features:
- Architecture: MVC architecture of AngularJS was replaced by a ‘service-controller’ architecture.
- View Engine: The view engine helps in reducing the component code by 60%. This makes the application lightweight as the bundles are reduced in size by several kilobytes.
- Animation: Animation now has a separate package. Animation can also be imported from the BrowserAnimationsModule from @angular/platform-browser/animations.
- Typescript: Angular 4 uses Typescript v2.2. Typescript is considered to be the superset of Javascript.
- New Keywords: Some new keywords like ‘as’ was introduced. This is generally used to store the output of a slice or a command in some variable. The ‘else’ condition was also introduced in Angular 4. The introduction of the ‘if-else; looping condition helped in code condensation.
- Use of ‘as’ keyword:
<div *ngFor=
"let j of weeks | slice:0:5 as num"
>
``Months: {{j}} Num: {{num.length}}
</div>
- Use of ‘if-else’ condition in Angular 4: The ‘ngIf’ outputs ‘Valid Condition’, whereas the ‘else’ condition outputs ‘Invalid Condition’.
<
span
*
ngIf
=
"isavailable; else condition1"
>
Valid Condition.</
span
>
<
ng-template
#condition1>
Invalid Condition</
ng-template
>
- Use of ‘as’ keyword:
- Mobile Support: Angular 4 is supported by almost every modern day mobile browser.
- HTTP Search Parameter: There is no need to call the URLSearchParams for the HTTP search parameter.
- Compatibility with the previous version: Angular 4 is compatible with Angular 2 and AngularJS. Projects developed in Angular 2 will work without any problem in Angular 4.
Similar Reads
- Angular 7 | Introduction Angular 7 is a TypeScript based front-end web framework by Google. It enables you to create Single Page Applications(SPA) with the help of the concept of components. The components in Angular 7 are structured like a tree i.e. there are parent and child components in which each child component is con 2 min read
- Angular 8 | Introduction Angular 8 is a client-side TypeScript based, front-end web framework by Google. Angular 8 is a great, reusable UI (User Interface) library for the developers which help in building attractive, steady, and utilitarian web pages and web application. Angular 8 is a ground-breaking JavaScript framework 4 min read
- Introduction to AngularJS AngularJS is a popular open-source framework that simplifies web development by creating interactive single-page applications (SPAs). Unlike traditional websites that load new pages for each click, SPAs offer a smoother user experience by updating content on the same page. AngularJS makes this possi 4 min read
- Introduction to AngularDart In this article, we will look at the basics of the AngularDart framework and how can we get started with it in online mode. So first let's see what is Dart. Dart: Dart is an object-oriented programming language that supports a various range of programming paradigms like Classes, Polymorphism, Interf 4 min read
- Introduction to Angular Concepts Angular, a powerful front-end framework developed by Google, has revolutionized the way modern web applications are built. For newcomers to web development, Angular can seem to be a great choice due to its features, concepts, and terminologies. In this article, we'll see more about the journey of An 5 min read
- Introduction to Angular Universal In the last few years, Angular become one of the most famous front-end framework to develop single page application. Most of the people think Angular only works on client-side but its partially true as there is one concept in Angular which explain some part of the application to be rendered at serve 4 min read
- Angular Internationalization Internationalization (i18n) is a key feature in Angular that allows applications to be adapted for different languages and regions without needing to rewrite the core code. This article will walk you through the process of implementing i18n in Angular, including setup, translation, and configuration 6 min read
- Angular 7 | Directives Directives in Angular 7 are Typescript class which is declared with decorator @Directive. These are the Document Object Model (DOM) instruction sets, which decide how logic implementation can be done.Angular directives can be classified into three types: Component Directives: It forms the main class 3 min read
- AngularJS | Application Applications in AngularJS enable the creation of real-time Applications. There are four primary steps involved in creation of Applications in AngularJS: Creation of List for an Application. Adding elements in the List. Removing elements from the List. Error Handling Below are the steps for creations 3 min read
- Angular Tutorial Angular is a powerful, open-source web application framework for building dynamic and scalable single-page applications (SPAs). Developed by Google, Angular provides a comprehensive solution for front-end development with tools for routing, form handling, HTTP services, and more. Designed for buildi 5 min read