Skip to main content

New features of Angular 4


Let us now see the new features added to Angular 4 −

ngIf

Angular2 supported only the if condition. However, Angular 4 supports the if else condition as well. Let us see how it works using the ng-template.
*ngIf="isavailable; else condition1">Condition is valid.
Condition is invalid

as keyword in for loop

With the help of as keyword you can store the value as shown below −
ngFor="let i of months | slice:0:5 as total"> Months: {{i}} Total: {{total.length}}
The variable total stores the output of the slice using the as keyword.

Animation Package

Angular 4 is available as a separate package and needs to be imported from @angular/animations
In Angular2, it was available with @angular/core

Template

Angular 4 uses  as the tag instead of  

TypeScript 2.2

Angular 4 is updated to a recent version of TypeScript, which is 2.2.

Pipe Title Case

Angular 4 has added a new pipe title case, which changes the first letter of each word into uppercase.

{{ 'Angular 4 titlecase' | titlecase }}
The above line of code generates the following output – Angular 4 Titlecase.

Http Search Parameters

Search parameters to the http get api is simplified. We do not need to call URLSearchParams for the same as was being done in Angular2.

Smaller and Faster Apps




















































Comments

Popular posts from this blog

Microservices Design patterns

What are microservices? Microservices - also known as the microservice architecture - is an architectural style that structures an application as a collection of services that are Highly maintainable and testable Loosely coupled Independently deployable Organized around business capabilities Owned by a small team The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack. You are developing a server-side enterprise application. It must support a variety of different clients including desktop browsers, mobile browsers and native mobile applications. The application might also expose an API for 3rd parties to consume. It might also integrate with other applications via either web services or a message broker. The application handles requests (HTTP requests and messages) by executing business logic; accessing a database; exchanging messages with other systems; and returni...

GraphQL

What is GraphQL  API Standard invented & open-sourced by Facebook Alternative to  REST API  enables declarative data fetching  exposes single endpoint & responds to queries How it works?  Why Graphql? Improvises performance by reducing the data that is to be transferred over the internet Variety of different frontend frameworks and platforms on client-side Fast development speed & expectation for rapid feature development Why Graphql is better than REST? Flexibility & efficient  No more over /under fetching of data Over fetching : Under fetching: Insightful analytics  Schema serves as contract between client and server CORE CONCEPTS : SDL :SCHEMA DEFINITION LANGUAGE Writing Data with mutations 3 kinds of mutations creating new data updating existing data deleting existing data