1.

How is the Ionic Framework v4 different from v3?

Answer»

Ionic V4 offers significant changes in performance, compatibility with multiple frameworks and many other improvements compared to previous versions. 

  • Web Components:

Ionic V4 was completely rewritten to use WebAPIs and each component is packaged as a Web Component. Web Component defines as a set of Web APIs that allow you to create HTML tags that are reusable in nature. With Web Components, we can create almost anything that can be worked with HTML, CSS, and Javascript. We can also create a portable component that can be reused.

  • Compatibility with other Frameworks:

Since it's INCEPTION Ionic Framework was BUILT using Angular but Ionic v4 is completely independent of the base framework. Since the components of the Ionic Framework such as ion-BUTTON, are now encapsulated as Web Components. Web components work with any framework, in fact, it can be done without any framework.

  • Navigation: 

In Ionic 4 there are great changes in the navigation and the Router by use of Angular Router. Ionic 3 used navigation based on a simple stack where the new pages were placed on top of the stack doing push and when we wanted to navigate backward a pop of the last page is CREATED. Traditional websites use a linear history which means that the user navigates to a page and can press the Back button to navigate back. In Ionic Framework, APPLICATIONS can take this a step further by allowing parallel navigation for its user. Which means that now it is possible to have multiple navigation batteries and exchange them at any time. Also to mention NavController and ion-nav in Ionic4 have become obsolete. It can still be used but only if the application does not use Lazy Loading. Instead of NavController and ion-nav, Ionic4 uses @angular/router.

Ionic 4

Ionic 3

Life cycles of navigation (LifeCycles):

The lifecycles that were used in Ionic 3 as ionWillLoad will no longer be used in Ionic 4. It uses Angular life cycles such as ngOnInit and ngAfterViewInit.

routerLink:
In Ionic 3 the event (click) is used to navigate between pages from the HTML. In Ionic 4 we will use the routerLink , as it is used in the Angular applications.

Modules:
It is not necessary to import the pages and services in the app.module.ts file. For each page there will be a module of that page, for eg: to use Reactive Forms on any page, we only import ReactiveFormsModule on the page or pages that will use it.



Discussion

No Comment Found