Layering component styles (css) on top of each other - angular-material

In our SPA there is a strange feature of css styles behavior,
the problem is layering styles, this happens when you go to /rout (links), styles from the previous component are saved and added to the new, when you reload such a page in the browser (ctrl+r) everything falls into place, the component begins to have only its own css styles.
our sequence of actions:
open the component [A]
transition to component [B]
styles of component [A] added to component [B]
we pass from component [B] already in [С]
component [С] has styles from the whole chain of transitions [А] + [B] + [С] although it should have only [С]
We use:
"dependencies": {
"#amcharts/amcharts4": "^4.1.3",
"#angular/animations": "^7.2.4",
"#angular/cdk": "^7.3.1",
"#angular/common": "^7.2.4",
"#angular/compiler": "^7.2.4",
"#angular/core": "^7.2.4",
"#angular/forms": "^7.2.4",
"#angular/http": "^7.2.4",
"#angular/material": "^7.3.1",
"#angular/platform-browser": "^7.2.4",
"#angular/platform-browser-dynamic": "^7.2.4",
"#angular/router": "^7.2.4",
"#compodoc/compodoc": "^1.1.7",
"#molteni/export-csv": "0.0.2",
"#ngx-translate/core": "^11.0.1",
"#ngx-translate/http-loader": "^4.0.0",
"copyfiles": "^2.1.0",
"core-js": "^2.6.2",
"decimal.js-light": "^2.5.0",
"google-protobuf": "^3.6.1",
"grpc-web": "^1.0.3",
"hammerjs": "^2.0.8",
"husky": "^1.2.0",
"jquery": "^3.3.1",
"ngx-i18n-combine": "^1.1.0",
"ngx-translate-parser-plural-select": "^1.1.3",
"node-sass": "^4.11.0",
"normalize.css": "^8.0.1",
"protobufjs": "^6.8.8",
"qrious": "^4.0.2",
"rxjs": "^6.3.3",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular-builders/jest": "^7.2.0",
"#angular-devkit/build-angular": "~0.12.1",
"#angular/cli": "~7.2.1",
"#angular/compiler-cli": "^7.2.0",
"#angular/language-service": "^7.2.0",
"#commitlint/cli": "^7.3.2",
"#commitlint/config-angular": "^7.3.1",
"#types/google-protobuf": "^3.2.7",
"#types/jquery": "^3.3.29",
"#types/node": "~10.12.12",
"codelyzer": "~4.5.0",
"commitizen": "^2.7.6",
"cz-customizable": "^5.3.0",
"date-format": "^2.0.0",
"fs-extra": "^7.0.1",
"git-describe": "^4.0.3",
"hash-files": "^1.1.1",
"htmllint": "^0.7.3",
"htmllint-cli": "0.0.7",
"http-server": "^0.11.1",
"jest": "^23.6.0",
"js-beautify": "^1.8.9",
"minimist": "^1.2.0",
"protractor": "^5.4.2",
"replace": "^1.0.1",
"stylelint": "^9.9.0",
"stylelint-config-standard": "^18.2.0",
"tar": "^4.4.8",
"ts-node": "^7.0.1",
"tslint": "^5.12.0",
"typescript": "3.1.6",
"typescript-formatter": "^7.2.2",
"webpack-bundle-analyzer": "^3.0.3"
}

Related

Firestore with Ionic5 not working on deployed iphone

I have an Ionic 5 app with firestore and cordova.
In the browser, on Android and using livereload on IOS ( ionic cordova run ios --livereload) the app works as expected.
However, when I just build the app (cordova ionic build ios) and end up deploying it to my iphone, the app cannot connect to firebase. Unfortunately I don't have any logs, but a login and read collections don't provide any data.
Do I still need to put the firebase URL somewhere to allow the app to access the internet?
Thanks in advance.
My package.json:
"dependencies": {
"#angular/common": "^12.2.11",
"#angular/core": "^12.2.11",
"#angular/fire": "^7.1.1",
"#angular/forms": "^12.2.11",
"#angular/platform-browser": "^12.2.11",
"#angular/platform-browser-dynamic": "^12.2.11",
"#angular/router": "^12.2.11",
"#ionic-native/background-geolocation": "^5.36.0",
"#ionic-native/broadcaster": "^5.36.0",
"#ionic-native/camera-preview": "^5.36.0",
"#ionic-native/core": "^5.36.0",
"#ionic-native/file": "^5.36.0",
"#ionic-native/file-opener": "^5.36.0",
"#ionic-native/firebase": "^5.36.0",
"#ionic-native/header-color": "^5.36.0",
"#ionic-native/ionic-webview": "^5.36.0",
"#ionic-native/open-native-settings": "^5.36.0",
"#ionic-native/printer": "^5.36.0",
"#ionic-native/splash-screen": "^5.36.0",
"#ionic-native/status-bar": "^5.36.0",
"#ionic-native/toast": "^5.36.0",
"#ionic/angular": "^5.8.5",
"#ionic/core": "^5.8.5",
"#ionic/storage": "2.2.0",
"#tensorflow/tfjs": "^0.13.5",
"#types/webgl2": "0.0.6",
"chart.js": "^2.7.3",
"cordova-android": "9.1.0",
"cordova-open-native-settings": "^1.5.5",
"cordova-plugin-broadcaster": "^4.1.0",
"cordova-plugin-camera-preview": "^0.11.1",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-headercolor": "^1.0.0",
"cordova-plugin-ionic": "^5.4.6",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-splashscreen": "^5.0.3",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-toast": "^2.7.2",
"firebase": "^9.2.0",
"ionic-img-viewer": "^2.9.0",
"ng2-validation": "^4.2.0",
"rxjs": "^6.5.3 || ^7.0.0",
"rxjs-compat": "^6.6.7",
"sw-toolbox": "^3.6.0",
"tslib": "^1.14.1",
"zone.js": "~0.11.4"
},
"devDependencies": {
"#angular-devkit/build-angular": "^12.2.10",
"#angular-eslint/builder": "12.5.0",
"#angular-eslint/eslint-plugin": "12.5.0",
"#angular-eslint/eslint-plugin-template": "12.5.0",
"#angular-eslint/template-parser": "12.5.0",
"#angular/cli": "^12.2.10",
"#angular/compiler": "^12.2.11",
"#angular/compiler-cli": "^12.2.11",
"#angular/language-service": "^12.2.11",
"#ionic/angular-toolkit": "^5.0.3",
"#ionic/v4-migration-tslint": "^1.7.1",
"#types/jasmine": "~3.6.0",
"#types/jasminewd2": "~2.0.3",
"#types/node": "^12.11.1",
"#typescript-eslint/eslint-plugin": "4.16.1",
"#typescript-eslint/parser": "4.16.1",
"cordova-ios": "^6.2.0",
"cordova-plugin-pico": "^1.0.0",
"cordova-plugin-printer": "^0.8.0",
"eslint": "^7.6.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsdoc": "30.7.6",
"eslint-plugin-prefer-arrow": "1.2.2",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.2",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"prettier": "2.4.1",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"typescript": "~4.3.5"
},
I think package firestore with version 9 is using ios and indexedDB to store something about the authentification. Then you must add this code :
const app = initializeApp(environment.firebase);
if (Capacitor.isNativePlatform()) {
initializeAuth(app, {
persistence: indexedDBLocalPersistence
});
}
this.firestore = getFirestore(app);
See original answer : https://forum.ionicframework.com/t/firebase-auth-in-sdk-9-does-not-work-on-ios-sim-or-devices/215362

How do I know which plugin is using UIWebView?

When I execute grep -R UIWebView * in this directory:
Users/anonymous/Library/Developer/Xcode/Archives/2021-04-16/app name 4-16-21, 3.42 PM.xcarchive
I get the following results:
Binary file Products/Applications/app name.app/App Name matches
Binary file dSYMs/App Name.app.dSYM/Contents/Resources/DWARF/App Name matches
I'm not sure what that means...I received that from Apple support but how do I identify the plugin causing the issue?
When I run the same cmd from the following location:
Users/anonymous/project/app-name-v5/platforms/ios
Binary file build/emulator/Heathen Mingle.app.dSYM/Contents/Resources/DWARF/App Name matches
build/sharedpch/SharedPrecompiledHeaders/6177444177259162338/App Name-Prefix.pch.d: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIWebView.h \
None of those are helping me identify which plugin has UIWebView included. My app keeps getting rejected by Apple for having UIWebView but I'm not sure which plugin still contains it.
"dependencies": {
"#angular/common": "~8.2.14",
"#angular/core": "~8.2.14",
"#angular/fire": "^5.4.2",
"#angular/forms": "~8.2.14",
"#angular/platform-browser": "~8.2.14",
"#angular/platform-browser-dynamic": "~8.2.14",
"#angular/router": "~8.2.14",
"#ionic-native/core": "^5.0.0",
"#ionic-native/diagnostic": "^5.26.0",
"#ionic-native/firebase-messaging": "^5.32.1",
"#ionic-native/geolocation": "^5.23.0",
"#ionic-native/image-picker": "^5.32.0",
"#ionic-native/in-app-browser": "^5.32.1",
"#ionic-native/in-app-purchase-2": "^5.32.1",
"#ionic-native/ionic-webview": "^5.22.0-beta-1",
"#ionic-native/splash-screen": "^5.32.0",
"#ionic-native/status-bar": "^5.32.0",
"#ionic/angular": "^5.0.0",
"#ionic/storage": "2.2.0",
"cc.fovea.cordova.purchase": "^10.1.1",
"cordova-android-support-gradle-release": "^3.0.1",
"cordova-ios": "^6.2.0",
"cordova-plugin-androidx": "^3.0.0",
"cordova-plugin-androidx-adapter": "^1.1.3",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-firebase-analytics": "^5.0.0",
"cordova-plugin-firebase-messaging": "^5.0.1",
"cordova-plugin-geolocation": "^4.1.0",
"cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-telerik-imagepicker": "^2.3.6",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-sqlite-storage": "^6.0.0",
"cordova-support-android-plugin": "^1.0.2",
"cordova-support-google-services": "^1.4.1",
"cordova.plugins.diagnostic": "^5.0.2",
"core-js": "^2.5.4",
"firebase": "^7.9.1",
"geofire": "^5.0.1",
"geofirex": "^0.1.0",
"ionicons": "^4.5.10-0",
"moment": "^2.24.0",
"rxjs": "~6.5.1",
"rxjs-compat": "^6.5.5",
"tslib": "^1.9.0",
"zone.js": "~0.9.1"
},
"devDependencies": {
"#angular-devkit/build-angular": "~0.803.20",
"#angular/cli": "~8.3.23",
"#angular/compiler": "~8.2.14",
"#angular/compiler-cli": "~8.2.14",
"#angular/language-service": "~8.2.14",
"#ionic/angular-toolkit": "^2.1.1",
"#types/jasmine": "~3.3.8",
"#types/jasminewd2": "~2.0.3",
"#types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-splashscreen": "^6.0.0",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.1",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.0",
"ts-node": "~7.0.0",
"tslint": "~5.15.0",
"typescript": "~3.4.3"
},
I've upgraded all of them and I've removed Google +
Check out Ionic's official blog post on the topic if you haven't already. It covers all the steps and notes which Cordova plugins may still trigger the rejection.
Some suggestions:
Firebase - consider migrating to Cap Community firebase plugins.
Nothing else stands out. Broadly speaking, review your plugin list - which ones interact with a WebView and/or the webview apis?

Ionic 3 - App stuck on splashscreen. Starts running once I make a change and refreshes while emulating (iOS)

Have an Ionic 3 app, that gets stuck on splash screen when I'm emulating on iOS. Funny thing, if I add a space to a ts file, it refreshes and starts working.
This is messing up my E2E testing with Appium, so I'm wondering if anyone has a better idea of what might be causing this behaviour.
I'm leaving here all package.json dependencies, in case that helps:
"dependencies": {
"#angular/animations": "^4.0.0",
"#angular/cdk": "^2.0.0-beta.12",
"#angular/common": "5.0.0",
"#angular/compiler": "5.0.0",
"#angular/compiler-cli": "5.0.0",
"#angular/core": "5.0.0",
"#angular/forms": "^5.0.0",
"#angular/http": "5.0.0",
"#angular/platform-browser": "5.0.0",
"#angular/platform-browser-dynamic": "5.0.0",
"#ionic-native/aes-256": "^4.20.0",
"#ionic-native/battery-status": "^4.9.0",
"#ionic-native/core": "^4.10.1",
"#ionic-native/device": "^4.17.0",
"#ionic-native/dialogs": "^4.9.0",
"#ionic-native/file": "^4.9.0",
"#ionic-native/file-chooser": "^4.10.0",
"#ionic-native/file-path": "^4.10.0",
"#ionic-native/file-transfer": "^4.20.0",
"#ionic-native/http": "^4.10.0",
"#ionic-native/insomnia": "^4.9.2",
"#ionic-native/keyboard": "^4.15.0",
"#ionic-native/local-notifications": "^4.9.0",
"#ionic-native/media": "^4.9.0",
"#ionic-native/network": "^4.17.0",
"#ionic-native/power-management": "^4.9.2",
"#ionic-native/pro": "^4.9.2",
"#ionic-native/screen-orientation": "^4.20.0",
"#ionic-native/splash-screen": "4.3.2",
"#ionic-native/status-bar": "4.3.2",
"#ionic/pro": "^2.0.3",
"#ionic/storage": "2.1.3",
"#types/crypto-js": "^3.1.43",
"awesome": "0.0.7",
"bootstrap": "^4.0.0-beta.2",
"cordova-ios": "5.0.0",
"cordova-plugin-advanced-http": "^1.11.1",
"cordova-plugin-android-permissions": "^1.0.0",
"cordova-plugin-background-upload": "^1.0.12",
"cordova-plugin-badge": "0.8.8",
"cordova-plugin-battery-status": "^2.0.2",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-dialogs": "^2.0.1",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-filechooser": "^1.2.0",
"cordova-plugin-filepath": "^1.5.1",
"cordova-plugin-insomnia": "^4.3.0",
"cordova-plugin-ionic": "^5.3.0",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^2.3.1",
"cordova-plugin-ios-camera-permissions": "^1.2.0",
"cordova-plugin-ios-disableshaketoedit": "^1.0.0",
"cordova-plugin-itunesfilesharing": "0.0.1",
"cordova-plugin-local-notification": "0.9.0-beta.2",
"cordova-plugin-media": "^5.0.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-powermanagement-orig": "^1.1.2",
"cordova-plugin-screen-orientation": "^3.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"crypto-js": "^3.1.9-1",
"es6-promise-plugin": "^4.2.2",
"font-awesome": "4.7.0",
"hammerjs": "^2.0.8",
"ionic-angular": "3.9.2",
"ionic-native-datepicker": "^1.0.5",
"ionicons": "3.0.0",
"ios-sim": "^8.0.2",
"jquery": "3.3.1",
"jwt-decode": "^2.2.0",
"ngx-dropdown-list": "^1.1.1",
"ngx-infinite-scroll": "^0.8.3",
"ngx-pagination": "^4.1.0",
"ngx-select-dropdown": "^1.0.1",
"node-sass": "4.9.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"web-animations-js": "^2.3.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#angular/cli": "^1.5.0",
"#angular/router": "^4.4.6",
"#ionic/app-scripts": "^3.2.4",
"#types/jasmine": "^2.6.3",
"#wdio/appium-service": "^6.4.0",
"#wdio/cli": "^6.4.2",
"#wdio/local-runner": "^6.4.2",
"#wdio/mocha-framework": "^6.4.0",
"#wdio/selenium-standalone-service": "^6.4.0",
"#wdio/spec-reporter": "^6.4.0",
"#wdio/sync": "^6.4.0",
"appium": "^1.18.1",
"appium-doctor": "^1.15.3",
"chromedriver": "^84.0.1",
"ionic-mocks": "^0.13.0",
"jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"karma-junit-reporter": "^1.2.0",
"protractor": "^5.1.2",
"sass-loader": "^6.0.7",
"ts-node": "^3.3.0",
"tslint-eslint-rules": "^4.1.1",
"typescript": "^2.4.2",
"wdio-appium-service": "^0.2.3",
"wdio-chromedriver-service": "^6.0.3",
"wdio-jasmine-framework": "^0.3.8",
"wdio-mochawesome-reporter": "^4.0.0",
"wdio-spec-reporter": "^0.1.5",
"webdriverio": "^6.4.2",
"ws": "3.3.2"
},
BTW, already tried the following:
Removing platform and building again
ionic cordova platform rm ios
ionic cordova platform add ios#5.0.0
ionic cordova emulate ios -lc --target iPad--6th-generation-
When preparing/building I have a different issue:
ionic-app-script task: "build"
Error: Failed to transpile program
at new BuildError ([...]/node_modules/#ionic/app-scripts/dist/util/errors.js:16:28)
Ok, basically there was a conflict between Ionic and Appium dependencies.
Spent a few hours trying to crack that, but opted for moving appium implementation along with E2E tests to a separate folder.
Clean and rebuild
ionic clean
ionic build

Identify which plugin uses UIWebView

I have updated codorva-ios to ^5.1.1 and add following lines in config.xml, but still getting UIWebView warning;
<preference name="WKWebViewOnly" value="true" /> <feature name="CDVWKWebViewEngine"> <param name="ios-package" value="CDVWKWebViewEngine" /> </feature> <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
My plugins are
"dependencies": {
"#angular/common": "5.0.0",
"#angular/compiler": "5.0.0",
"#angular/compiler-cli": "5.0.0",
"#angular/core": "5.0.0",
"#angular/forms": "5.0.0",
"#angular/http": "5.0.0",
"#angular/platform-browser": "5.0.0",
"#angular/platform-browser-dynamic": "5.0.0",
"#ionic-native/camera": "^4.7.0",
"#ionic-native/core": "4.3.2",
"#ionic-native/crop": "^4.7.0",
"#ionic-native/file": "^4.7.0",
"#ionic-native/file-transfer": "^4.7.0",
"#ionic-native/fingerprint-aio": "4.4.0",
"#ionic-native/firebase": "^4.12.0",
"#ionic-native/geolocation": "^4.7.0",
"#ionic-native/in-app-browser": "^4.20.0",
"#ionic-native/keyboard": "^4.7.0",
"#ionic-native/network": "^4.7.0",
"#ionic-native/photo-viewer": "^4.7.0",
"#ionic-native/screen-orientation": "4.20.0",
"#ionic-native/social-sharing": "^4.7.0",
"#ionic-native/splash-screen": "4.3.2",
"#ionic-native/sqlite": "^4.12.2",
"#ionic-native/sqlite-porter": "^4.12.2",
"#ionic-native/status-bar": "4.3.2",
"#ionic-native/unique-device-id": "^4.12.0",
"#ionic/storage": "2.1.3",
"#types/moment-timezone": "^0.5.13",
"angularfire2": "^5.0.0-rc.11",
"chart.js": "^2.7.2",
"com-sarriaroman-photoviewer": "^1.2.5",
"cordova-android": "^6.3.0",
"cordova-ios": "^5.1.1",
"cordova-plugin-add-swift-support": "^2.0.2",
"cordova-plugin-camera": "^4.1.0",
"cordova-plugin-crop": "^0.4.0",
"cordova-plugin-device": "^1.1.7",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-fingerprint-aio": "^2.0.0",
"cordova-plugin-firebase": "^1.1.4",
"cordova-plugin-geolocation": "^4.0.2",
"cordova-plugin-inappbrowser": "^4.0.0",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-ionic-webview": "^5.0.0",
"cordova-plugin-network-information": "^2.0.2",
"cordova-plugin-screen-orientation": "^2.0.2",
"cordova-plugin-splashscreen": "^4.1.0",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-touch-id": "^3.4.0",
"cordova-plugin-uniquedeviceid": "^1.3.2",
"cordova-plugin-whitelist": "^1.3.4",
"cordova-plugin-x-socialsharing": "^5.6.8",
"cordova-sqlite-storage": "^2.6.0",
"cordova-windows": "4.4.2",
"es6-promise-plugin": "^4.2.2",
"firebase": "^5.4.1",
"intl": "^1.2.5",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionic2-calendar": "^0.4.4",
"ionic2-rating": "^1.2.2",
"ionicons": "3.0.0",
"jquery": "^3.3.1",
"moment": "^2.22.1",
"moment-timezone": "^0.5.17",
"ng2-appinsights": "^1.0.0-beta.1",
"ng2-charts": "^1.6.0",
"ngx-webstorage": "^2.0.1",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.2.2",
"sw-toolbox": "3.6.0",
"uk.co.workingedge.cordova.plugin.sqliteporter": "^1.1.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "3.1.0"
},
I have updated InAppBrowser plugin. Can anybody tell me which plugin/version using UIWebView and how I resolve it?
Please specify the plugin name which is creating problem and from which version I can replace to fix this problem.

DataTable: Print Not working in Angular 9 and Electron

I have an android 9 app recently converted to Electron app.
For DataTable, I have enabled Print and Excel options. Excel upload is fine and exporting data.
But Print is not working.
Its giving the following error
TypeError: Cannot read property 'close' of undefined at _Api.action (buttons.print.js:140) at action (dataTables.buttons.js:559)
I could see that win.document is null in buttons.print.js.
Also if I build it as normal ANgular app ( ng serve) , print is working fine too
In Angular.JSON I have loaded the script in following order
"node_modules/jquery/dist/jquery.min.js",
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js",
"node_modules/datatables.net-buttons/js/dataTables.buttons.js",
"node_modules/datatables.net-buttons/js/buttons.colVis.js",
"node_modules/datatables.net-buttons/js/buttons.flash.js",
"node_modules/datatables.net-buttons/js/buttons.html5.js",
"node_modules/datatables.net-buttons/js/buttons.print.js",
"node_modules/bootstrap/dist/js/bootstrap.min.js",
"node_modules/jszip/dist/jszip.js"
The package.json file is as follows
"dependencies": {
"jquery": "^3.4.1",
"datatables.net": "^1.10.19",
"datatables.net-buttons": "^1.5.4",
"datatables.net-buttons-dt": "^1.5.4",
"datatables.net-dt": "^1.10.19",
"#angular-devkit/build-angular": "^0.900.2",
"#angular/animations": "~9.0.1",
"#angular/common": "~9.0.1",
"#angular/compiler": "~9.0.1",
"#angular/core": "~9.0.1",
"#angular/forms": "~9.0.1",
"#angular/localize": "9.0.1",
"#angular/platform-browser": "~9.0.1",
"#angular/platform-browser-dynamic": "~9.0.1",
"#angular/router": "~9.0.1",
"#fortawesome/angular-fontawesome": "^0.3.0",
"#fortawesome/fontawesome-svg-core": "^1.2.14",
"#fortawesome/free-solid-svg-icons": "^5.7.1",
"#ng-bootstrap/ng-bootstrap": "4.2.2",
"angular-datatables": "^7.0.0",
"bootstrap": "^4.3.1",
"core-js": "^2.5.4",
"cors": "^2.8.5",
"express": "^4.16.4",
"indexeddb-angular": "^0.1.8",
"jszip": "^3.1.5",
"luxon": "^1.16.0",
"moment": "^2.24.0",
"moment-timezone": "^0.5.23",
"ngx-indexed-db": "^2.0.5",
"ngx-material-timepicker": "^3.1.0",
"ngx-multi-window": "0.3.2",
"ngx-print": "^1.1.4",
"popper.js": "^1.14.6",
"rxjs": "~6.5.4",
"tslib": "1.10.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"#angular-builders/custom-webpack": "8.4.1",
"#angular-eslint/builder": "0.0.1-alpha.18",
"#angular/cli": "9.0.2",
"#angular/compiler-cli": "9.0.1",
"#angular/language-service": "9.0.1",
"#ngx-translate/core": "12.0.0",
"#ngx-translate/http-loader": "4.0.0",
"#types/datatables.net": "^1.10.14",
"#types/datatables.net-buttons": "^1.4.0",
"#types/jasmine": "3.3.16",
"#types/jasminewd2": "2.0.8",
"#types/jquery": "^3.3.29",
"#types/mocha": "5.2.7",
"#types/node": "12.11.1",
"#typescript-eslint/eslint-plugin": "2.19.0",
"#typescript-eslint/parser": "2.19.0",
"chai": "4.2.0",
"codelyzer": "5.1.2",
"conventional-changelog-cli": "2.0.32",
"core-js": "3.1.4",
"cross-env": "7.0.0",
"electron": "8.0.0",
"electron-builder": "22.3.2",
"electron-reload": "1.5.0",
"eslint": "6.8.0",
"eslint-plugin-import": "2.20.1",
"jasmine-core": "3.4.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.2.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "2.1.1",
"karma-electron": "6.3.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"mocha": "6.2.2",
"ngx-electron": "2.2.0",
"npm-run-all": "4.1.5",
"protractor": "~5.4.0",
"spectron": "10.0.1",
"ts-node": "8.3.0",
"tslint": "~5.11.0",
"typescript": "3.7.5",
"wait-on": "4.0.0",
"webdriver-manager": "12.1.7"
},
Any pointers on this will be helpful
The information given in the post helped me ( angular application build in electron print a div shows blank window ).
The answer is : in main.ts for electron, need to add
nativeWindowOpen: true as below.
win = new BrowserWindow({
x: 0,
y: 0,
width: size.width,
height: size.height,
webPreferences: {
nodeIntegration: true,
nativeWindowOpen: true, //**** add this**
allowRunningInsecureContent: (serve) ? true : false,
},
});

Resources