Angular Universal with i18n (Server Side Rendering)

A solution is to pre-build packages for each language, and have a proxy detect which bundle to serve as default. From the Angular docs on i8n: Merge with the AOT compiler The AOT (Ahead-of-Time) compiler is part of a build process that produces a small, fast, ready-to-run application package. When you internationalize with the AOT … Read more

Angular 6 library shared stylesheets

For global styles, I’ve answered it in this question. Update For ng-packgr versions 9.x and above Copying assest to output folder is now directly supported as explained in this page { “$schema”: “./node_modules/ng-packagr/package.schema.json”, “name”: “@my/library”, “version”: “1.0.0”, “ngPackage”: { “assets”: [ “CHANGELOG.md”, “./styles/**/*.theme.scss” ], “lib”: { … } } } So in your project you … Read more

How to use Puppeteer in an Angular application

How to use Angular e2e testing with Puppeteer 1) Install Puppeteer npm install –save-dev puppeteer @types/puppeteer 2) Configure Protractor to use Puppeteer Edit your protractor.conf.js and add the following inside capabilities: // … const puppeteer = require(‘puppeteer’); exports.config = { // … capabilities: { browserName: ‘chrome’, chromeOptions: { args: [‘–headless’], binary: puppeteer.executablePath(), }, }, // … Read more

How to create GUID in angular-2?

You even can use npm to generate this for you. Follow this : npm i guid-typescript –save And to utilize in your code : import { Guid } from ‘guid-typescript’; export class GuidExample { public id: Guid; constructor() { this.id = Guid.create(); // ==> b77d409a-10cd-4a47-8e94-b0cd0ab50aa1 } }

How to use other Angular2 service inside an ngrx/Store reducer?

There is no mechanism for injecting services into reducers. Reducers are supposed to be pure functions. Instead, you should use ngrx/effects – which is the mechanism for implementing action side-effects. Effects listens for particular actions, perform some side-effect and then (optionally) emit further actions. Typically, you would split your action into three: the request; the … Read more

What is the difference between Boolean and boolean in Typescript? [duplicate]

Uppercase Boolean is an object type. Lowercase boolean is a primitive type. You should always use boolean (the primitive type in your programs). This is because, the Typescript type system does not force an object to its primitive type, while JavaScript does. You shouldn’t write: function yourFunction(foo: Boolean) But instead always write: function yourFunction(foo: boolean) … Read more