Tag:

Angular

Navigating to a specific URL in your Angular PWA if its service worker is not yet registered

If you host an Angular Progressive Web App (PWA) on a web server, you will frequently have URLs that are handled by the Angular router to navigate to specific pages within the app.

However, without the service worker registered, navigation requests are not intercepted and sent to the PWA. In other words, if a user has never ran the PWA yet in his or her browser, a… Read more

Ionic 4 + Angular 7: Checking whether the generic parent of a component is the active page

There’s no straightforward way yet in getting the parent component of a component via dependency injection without knowing the type of the parent component. This poses a problem if you want your component consumed by many different types of parent components.

A common scenario where this problem occurs is an Ionic 4 app with several pages that use so… Read more

ngx-translate: translate your JSON file to other languages

For Angular 2/3/4/5/6/7 developers, use this gadget to translate your en.json file.

This is relevant for developers that use @ngx-translate/core similar to the following in app.module:

import { TranslateModule, TranslateLoader } from '@ngx-translate/core';

@NgModule({
/* ... */
  imports: [
    TranslateModule.forRoot({
      loader: {
        provide: Translat
Read more

Angular 2/3/4/5: change detection on data-bound array push/unshift, pop/shift or splice

Suppose you have a component and have bound an array variable to an input property, like so:

<myComponent [arrayInput]="myArray"></myComponent>

Suppose you were to modify the contents of myArray via its standard array methods such as push(x), pop(), unshift(x), shift(), or splice(i, c). You may notice that myComponent does n… Read more