{"id":52294,"date":"2017-11-07T13:45:51","date_gmt":"2017-11-07T08:15:51","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=52294"},"modified":"2017-11-14T14:09:09","modified_gmt":"2017-11-14T08:39:09","slug":"moving-to-angular-5-find-out-yay-or-nay","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/moving-to-angular-5-find-out-yay-or-nay\/","title":{"rendered":"Moving to Angular 5? Find out Yay or Nay!"},"content":{"rendered":"<p><span style=\"font-weight: 400\">AngularJS is quickly evolving and we have witnessed two major updates in the past 14 months. Now, this popular JavaScript framework has set a new milestone with its major release of Angular 5.0 on November 1, 2017.\u00a0T<\/span>he progressive web apps and material design powered by Google will be however available in the next few days.<\/p>\n<p><span style=\"font-weight: 400\">The all-new Angular 5 has exciting new features and fixes to previous bugs aimed at making Angular more compact, simplify its use and reduce the code size.\u00a0<\/span><\/p>\n<h2><strong>Here is the breakdown of all the new changes that Angular 5 brings to the table:<\/strong><\/h2>\n<h3><b>Build optimizer:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">The all-new Angular 5 comes with a build optimizer by default. It is a tool that performs additional <\/span><span style=\"font-weight: 400\">optimizations on builds, including better tree shaking. It is a command-line tool which decreases the size of the application by chucking away the waste lines of code or code not required.\u00a0<\/span><span style=\"font-weight: 400\">This will ultimately improve or increase the boot speed of the application for the end user.<\/span><\/p>\n<h3><b>Material Design components are more compatible:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">With Angular 5, the material design components\u00a0have become more user-friendly with server-side rendering. However, there are certain issues that Google is still fixing.\u00a0<\/span><\/p>\n<h3><b>Progressive Web Apps:<\/b><\/h3>\n<p><span style=\"font-weight: 400\"><a title=\"PWA\" href=\"http:\/\/www.tothenew.com\/blog\/progressive-web-apps-a-philosophy-for-modern-app-development\/\">Progressive Web Apps<\/a> deliver a rich user experience for all the mobile devices making them more engaging, reliable and fast. PWA is an allied between Mozilla and Google which aims at developing a browser-based application\u00a0providing a native-like experience.<\/span><\/p>\n<p><span style=\"font-weight: 400\">In the new version of Angular, Google has given\u00a0an\u00a0attention to making it easier for development teams to build PWA and this allows the apps to get cached in the browser. However, Google is working on building support for making CLI (Command in Line ) more capable. <\/span><span style=\"font-weight: 400\">\u201cWe\u2019re trying to find the right set of defaults so that it just would be the default option for most developers, for both desktop and mobile web,\u201d said Brad Green, a Google engineering director.\u00a0<\/span><\/p>\n<h3><b>Improving the compiler:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">The compiler is an essential part of the <a title=\"Angular framework \" href=\"http:\/\/www.tothenew.com\/front-end-angularjs-development\">Angular framework<\/a>, which has been improved with the latest version of Angular and is now being operated as TypeScripts transform to enable faster builds and rebuilds. Moreover, it will now <\/span><span style=\"font-weight: 400\">support the incremental assembling way better than before.\u00a0<\/span><\/p>\n<h3><b>ReflectivesInjector replaced by StaticInjector:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">The ReflectivesInjector has been replaced by StaticInjector so as to eliminated more polyfills, which as a result will make the application size concise for developers.<\/span><\/p>\n<p><strong><em>Before<\/em><\/strong><\/p>\n<p><span style=\"font-weight: 400\">ReflectiveInjector.resolveAndCreate(providers);<\/span><\/p>\n<p><strong><em>After<\/em><\/strong><\/p>\n<p><span style=\"font-weight: 400\">Injector.create(providers);<\/span><\/p>\n<h3><b>Pipes for the international number, currency, and dates:<\/b><\/h3>\n<p><span style=\"font-weight: 400\"><a title=\"Angular 5 development\" href=\"http:\/\/www.tothenew.com\/front-end-angularjs-development\">Angular 5<\/a> introduce pipes for the international number, currency, and dates. As a result, this will increase the standardization across browsers and eliminated the <\/span><span style=\"font-weight: 400\">dependency on i18n polyfills by making use of their own implementation for these pipes.<\/span><\/p>\n<h3><b>HttpClient:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">HTTPClient was introduced in Angular 4.3, which is now updated with the new version of Angular 5. The all-new updated version of HTTPClient is making the developers deprecate the previous @angular\/http library. In order to update HttpClient, developers need to replace HttpModule with HttpClientModule from @angular\/common\/http in each of the modules, inject the HttpClient service, and \u00a0eliminate any map(res =&gt; res.json()) calls, which are no longer required. \u00a0\u00a0<\/span><\/p>\n<h3><b>Support for Sharing Codes:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">With angular 5, sharing codes between client side and server side version of the application are now much easier. For this to happen, Google has introduced Angular Universal State Transfer API and DOM support. Angular Universal provides a support to the developers in order to perform server-side rendering of Angular applications. In a way to add support to the crawlers and scrapers which does not support JavaScript, developers have to first render their Angular application on the server and then they can bootstrap the application on top of the generated HTML. This will increase the overall performance of the application.<\/span><\/p>\n<h3><b>RxJS Reactive Programming Library update:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">With the new update, developers would become easy to eliminate the side effects of previous patch method of importing operators of code-splitting and tree-shaking problems. This new way of using \u00a0RxJS is called \u201c<\/span><a href=\"https:\/\/github.com\/ReactiveX\/rxjs\/blob\/master\/doc\/lettable-operators.md\"><span style=\"font-weight: 400\">lettable operators<\/span><\/a><span style=\"font-weight: 400\">\u201d. Also in addition to this, the ECMAScript module helps the RxJS to distribute the version. Moreover, the new Angular CLI will pull in ECMAScript by default. <\/span><\/p>\n<p><b><i>So now instead of<\/i><\/b><\/p>\n<p><span style=\"font-weight: 400\">import { Observable } from &#8216;rxjs\/Observable&#8217;;<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">import &#8216;rxjs\/add\/operator\/map&#8217;;<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">import &#8216;rxjs\/add\/operator\/filter&#8217;;<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">names = allUserData<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">.map(user =&gt; user.name)<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">.filter(name =&gt; name);<\/span><\/p>\n<p><b><i>The following would be used now <\/i><\/b><\/p>\n<p><span style=\"font-weight: 400\">import { Observable } from &#8216;rxjs\/Observable&#8217;;<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">import { map, filter } from &#8216;rxjs\/operators&#8217;;<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">names = allUserData.pipe(<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\"> \u00a0map(user =&gt; user.name),<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\"> \u00a0filter(name =&gt; name),<\/span><span style=\"font-weight: 400\"><br \/>\n<\/span><span style=\"font-weight: 400\">);<\/span><\/p>\n<h3><b>Easy Migration for the Users:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">Angular 5 have added multiple names for components and directives. This will give\u00a0an advantage to the users as they can migrate easily. It is possible to add a new name in the Angular mircosyntax without breaking the existing code and this can be done by exporting a directive with multiple names.<\/span><\/p>\n<h3><b>Angular Forms:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">For many applications, forms play an important part and with Angular Forms, it becomes easy for developers to take control of the validation and value updates on \u2018blur\u2019 or on \u2018submit\u2019 instead of every input event.<\/span><\/p>\n<h3><b>The Router:<\/b><\/h3>\n<p><span style=\"font-weight: 400\">There has been an addition of new lifecycle events to the router in order to allow the developers to track the router cycles from the start of running guards until completion of activation. Following are the new events:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ActivationStart<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">GuardsCheckEnd<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ResolveEnd<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ActivationEnd<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ChildActivationEnd<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ChildActivationStart<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">GuardsCheckStart<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">ResolveStart<\/span><\/li>\n<\/ul>\n<h2><b> Known issues with Angular 5<\/b><\/h2>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Design of the production and creation of source maps.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Few maps resulting in undefined sources for errors.<\/span><\/li>\n<\/ul>\n<p><a href=\"https:\/\/angular-update-guide.firebaseapp.com\/\"><span style=\"font-weight: 400\">Angular update guide<\/span><\/a><span style=\"font-weight: 400\"> will help the development teams to learn more about Angular updates. We are waiting for Angular 6 to be released early next year. Let\u2019s see what Angular 6 has in store for the development community.<\/span><\/p>\n<p>References<\/p>\n<div><a title=\"AngularJS Blog\" href=\"https:\/\/blog.angular.io\/version-5-0-0-of-angular-now-available-37e414935ced\">AngularJS Blog<\/a><\/div>\n<div><\/div>\n<div><a title=\"Medium\" href=\"https:\/\/medium.com\/m\/global-identity?redirectUrl=https:\/\/blog.angular.io\/version-5-0-0-of-angular-now-available-37e414935ced\">Medium<\/a><\/div>\n<div><\/div>\n<div><a title=\"Info world\" href=\"https:\/\/www.infoworld.com\/article\/3213244\/javascript\/whats-new-in-angular-5-easier-progressive-web-apps.html\">Info World<\/a><\/div>\n<div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>AngularJS is quickly evolving and we have witnessed two major updates in the past 14 months. Now, this popular JavaScript framework has set a new milestone with its major release of Angular 5.0 on November 1, 2017.\u00a0The progressive web apps and material design powered by Google will be however available in the next few days. [&hellip;]<\/p>\n","protected":false},"author":1116,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0},"categories":[1439,3429,1994,1],"tags":[4769,3955,4715,4444,1674,998,4768,1157,55,4710,1472,4755,4767,4117],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/52294"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/1116"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=52294"}],"version-history":[{"count":17,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/52294\/revisions"}],"predecessor-version":[{"id":52402,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/52294\/revisions\/52402"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=52294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=52294"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=52294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}