Posts

What is new in Angular 8?

Angular 8:

  • Releasing March/April 2019
  • Being smaller, faster and easier to use and it will be making Angular developers life easier.
  • Added Support for TypeScript 3.2
  • Added a Navigation Type Available during Navigation in the Router
  • Added pathParamsOrQueryParamsChange mode for runGuardsAndResolvers in the Router
  • Allow passing state to routerLink Directives in the Router
  • Allow passing state to NavigationExtras in the Router
  • Restore the whole object when navigating back to a page managed by Angular Router
  • Added support for SASS
  • Resolve generated Sass/Less files to .css inputs
  • Added Predicate function mode for runGuardsAndResolvers:-
    This option means guards and resolvers will ignore changes when a provided predicate function returns `false`. This supports use cases where an application needs to ignore some param updates but not others. For example, changing a sort param in the URL might need to be ignored, whereas changing the `project` param might require a re-run of guards and resolvers.
  • Added functionality to mark a control and its descendant controls as touched: — add markAllAsTouched () to AbstractControl
  • Added an ng-new command that builds the project with Bazel
  • Use image based cache for windows BuildKite
  • Export NumberValueAccessor & RangeValueAccessor directives
  • Use shared DomElementSchemaRegistry instance for improve performance of platform-server(@angular/platform-server):-
    Right now the ServerRendererFactory2 creates a new instance of the DomElementSchemaRegistry for each and every request, which is quite costly (for the Tour of Heroes SSR example this takes around **15%** of the overall execution time)
  • Now the Performance Improvements on the core, more consistent about “typeof checks”: –
    When testing whether `value` is an object, use the ideal sequence of strictly not equal to `null` followed by `typeof value === ‘object’` consistently. Specifically, there’s no point in using double equal with `null` since `undefined` is ruled out by the `typeof` check. Also avoid the unnecessary ToBoolean check on `value.ngOnDestroy` in `hasOnDestroy()`, since the `typeof value.ngOnDestroy === ‘function’` will only let closures pass and all closures are truish (with the notable exception of `document.all`, but that shouldn’t be relevant for the `ngOnDestroy` hook)
  • In the Compiler-CLI, expose ngtsc as a TscPlugin
  • Restore whole object when navigating back to a page managed by Angular Router:-
    This feature adds a few capabilities. First, when a `popstate` event fires the value of `history.state` will be read and passed into `NavigationStart`. In the past, only the `navigationId` would be passed here.
    Additionally, `NavigationExtras` has a new public API called `state` which is any object that will be stored as a value in `history.state` on navigation. For example, the object `{foo: ‘bar’}` will be written to `history.state` here: -`router.navigateByUrl(‘/simple’, {state: {foo: ‘bar’}});`