This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app.module.ts | |
export function win () { | |
return typeof window !== 'undefined' ? window : {}; | |
} | |
// ... in the NgModule | |
{ provide: WindowService, useFactory: (win) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const commonCliConfig = 'node_modules/@angular/cli/models/webpack-configs/common.js'; | |
const pug_rule = `\n{ test: /.(pug|jade)$/, loader: "apply-loader!pug-loader?self" },`; | |
fs.readFile(commonCliConfig, (err, data) => { | |
if (err) { throw err; } | |
const configText = data.toString(); | |
// make sure we don't add the rule if it already exists | |
if (configText.indexOf(pug_rule) > -1) { return; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ^ import the SwiperDirective MOCK we made, and include it in your AppServerModule @NgModule | |
declarations: [ | |
SwiperDirective // <-- this is the mock we made above | |
], |