ContentControl.insertOoxml adds extra paragraphs - ms-word

I am trying to add to my Word document a new content control with a table inside. I have the Ooxml of the table and I am inserting this to a new content control with insertOoxml. But it is adding a new paragraph before the table and another one after it, as shown in the following image.
This is my code:
Word.run(function (context) {
var range = context.document.getSelection();
var myContentControl = range.insertContentControl();
myContentControl.title = "ZZZ";
myContentControl.insertOoxml(dataXml, 'end');
myContentControl.cannotEdit = false;
myContentControl.cannotDelete = false;
context.load(myContentControl, 'id, title, tag');
return context.sync().then(function () {
console.log("Success");
});
});
This is the main part of dataXml content:
<?mso-application progid="Word.Document"?>
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<!-- ... -->
<pkg:part pkg:name="/word/document.xml" pkg:contentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml">
<pkg:xmlData>
<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://purl.oclc.org/ooxml/officeDocument/relationships" xmlns:m="http://purl.oclc.org/ooxml/officeDocument/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://purl.oclc.org/ooxml/wordprocessingml/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 wp14" w:conformance="strict">
<w:body>
<w:tbl>
<w:tblPr>
<w:tblStyle w:val="table" />
<w:tblW w:w="95.25pt" w:type="dxa" />
<w:tblInd w:w="0.8pt" w:type="dxa" />
<w:tblCellMar>
<w:top w:w="0pt" w:type="dxa" />
<w:start w:w="0pt" w:type="dxa" />
<w:bottom w:w="0pt" w:type="dxa" />
<w:end w:w="0pt" w:type="dxa" />
</w:tblCellMar>
<w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="1" w:lastRow="1" w:noVBand="1" />
</w:tblPr>
<w:tblGrid>
<w:gridCol w:w="952" />
<w:gridCol w:w="953" />
</w:tblGrid>
<w:tr>
<w:tblPrEx>
<w:tblW w:w="95.25pt" w:type="dxa" />
<w:tblInd w:w="0.8pt" w:type="dxa" />
<w:tblCellMar>
<w:top w:w="0pt" w:type="dxa" />
<w:start w:w="0pt" w:type="dxa" />
<w:bottom w:w="0pt" w:type="dxa" />
<w:end w:w="0pt" w:type="dxa" />
</w:tblCellMar>
<w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="1" w:lastRow="1" w:noVBand="1" />
</w:tblPrEx>
<w:trPr>
<w:trHeight w:hRule="exact" w:val="288" />
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="48.75pt" w:type="dxa" />
<w:tcBorders>
<w:top w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:start w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:bottom w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:end w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF" />
<w:noWrap />
<w:tcMar>
<w:top w:w="0.4pt" w:type="dxa" />
<w:start w:w="0.4pt" w:type="dxa" />
<w:bottom w:w="0.4pt" w:type="dxa" />
<w:end w:w="0.4pt" w:type="dxa" />
</w:tcMar>
<w:vAlign w:val="bottom" />
<w:hideMark />
</w:tcPr>
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
<w:t>A</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="48.75pt" w:type="dxa" />
<w:tcBorders>
<w:top w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:start w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:bottom w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:end w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF" />
<w:noWrap />
<w:tcMar>
<w:top w:w="0.4pt" w:type="dxa" />
<w:start w:w="0.4pt" w:type="dxa" />
<w:bottom w:w="0.4pt" w:type="dxa" />
<w:end w:w="0.4pt" w:type="dxa" />
</w:tcMar>
<w:vAlign w:val="bottom" />
<w:hideMark />
</w:tcPr>
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
<w:t>B</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
<w:tr>
<w:tblPrEx>
<w:tblW w:w="95.25pt" w:type="dxa" />
<w:tblInd w:w="0.8pt" w:type="dxa" />
<w:tblCellMar>
<w:top w:w="0pt" w:type="dxa" />
<w:start w:w="0pt" w:type="dxa" />
<w:bottom w:w="0pt" w:type="dxa" />
<w:end w:w="0pt" w:type="dxa" />
</w:tblCellMar>
<w:tblLook w:firstColumn="1" w:firstRow="1" w:lastColumn="1" w:lastRow="1" w:noVBand="1" />
</w:tblPrEx>
<w:trPr>
<w:trHeight w:hRule="exact" w:val="288" />
</w:trPr>
<w:tc>
<w:tcPr>
<w:tcW w:w="48.75pt" w:type="dxa" />
<w:tcBorders>
<w:top w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:start w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:bottom w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:end w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF" />
<w:noWrap />
<w:tcMar>
<w:top w:w="0.4pt" w:type="dxa" />
<w:start w:w="0.4pt" w:type="dxa" />
<w:bottom w:w="0.4pt" w:type="dxa" />
<w:end w:w="0.4pt" w:type="dxa" />
</w:tcMar>
<w:vAlign w:val="bottom" />
<w:hideMark />
</w:tcPr>
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
<w:t>C</w:t>
</w:r>
</w:p>
</w:tc>
<w:tc>
<w:tcPr>
<w:tcW w:w="48.75pt" w:type="dxa" />
<w:tcBorders>
<w:top w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:start w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:bottom w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
<w:end w:val="single" w:sz="6" w:space="0" w:color="B6B6B6" />
</w:tcBorders>
<w:shd w:val="clear" w:color="auto" w:fill="FFFFFF" />
<w:noWrap />
<w:tcMar>
<w:top w:w="0.4pt" w:type="dxa" />
<w:start w:w="0.4pt" w:type="dxa" />
<w:bottom w:w="0.4pt" w:type="dxa" />
<w:end w:w="0.4pt" w:type="dxa" />
</w:tcMar>
<w:vAlign w:val="bottom" />
<w:hideMark />
</w:tcPr>
<w:p>
<w:pPr>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
</w:pPr>
<w:r>
<w:rPr>
<w:rFonts w:ascii="Calibri" w:eastAsia="Calibri" w:hAnsi="Calibri" w:cs="Calibri" />
<w:b w:val="0" />
<w:bCs w:val="0" />
<w:i w:val="0" />
<w:iCs w:val="0" />
<w:smallCaps w:val="0" />
<w:color w:val="000000" />
<w:sz w:val="22" />
<w:szCs w:val="22" />
</w:rPr>
<w:t>D</w:t>
</w:r>
</w:p>
</w:tc>
</w:tr>
</w:tbl>
<w:p />
<w:sectPr>
<w:pgMar w:header="708" w:footer="708" />
<w:cols w:space="708" />
</w:sectPr>
</w:body>
</w:document>
</pkg:xmlData>
</pkg:part>
<!-- ... -->
</pkg:package>
I manage to remove the first extra paragraph with this code:
var paragraphs = myContentControl.paragraphs;
context.load(paragraphs, 'items');
return context.sync().then(function () {
paragraphs.items[0].delete();
return context.sync().then(function () {
console.log("Success");
});
});
But if I try to remove the last paragraph as in the following line, it removes the content control and doesn't delete the extra paragraph.
paragraphs.items[paragraphs.items.length - 1].delete();
How can I delete the last extra paragraph using Office.js and without removing the content control?

In all "modern" versions of Word (modern = versions that support text wrapping / free positioning of tables on the page) a paragraph following the table is required.
The paragraph mark is visible in the Word Open XML in the question:
</w:tbl>
<w:p />
<w:sectPr>
So it will not be possible to delete this paragraph.
It should be possible, however, to format it with a very small font size (as I recall, Word supports .5 pt as the minimum size) with no Space Before or Space After.
Background as to why the paragraph mark is needed: Word stores the placement information of the table on the page, as well as some other structural information "in" the paragraph mark. We can't see it, but it's what's happening "under the covers". Very similar to a Shape object's Anchor.

I found this workaround: insert directly to the document selection an Ooxml string containing also the content control and the table without paragraphs inside it.
So, this is the code:
Word.run(function (context) {
context.document.getSelection().insertOoxml(dataXml, 'Start');
return context.sync().then(function () {
console.log("Success");
});
});
This is the main part of dataXml content:
<pkg:package xmlns:pkg="http://schemas.microsoft.com/office/2006/xmlPackage">
<!-- ... -->
<pkg:xmlData>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main">
<w:body>
<w:sdt>
<w:sdtPr>
<w:alias w:val="ZZZ"/>
<w:id w:val="0"/>
</w:sdtPr>
<w:sdtEndPr/>
<w:sdtContent>
<w:tbl>
<!-- ... TABLE CONTENT ... -->
</w:tbl>
</w:sdtContent>
</w:sdt>
</w:body>
</w:document>
</pkg:xmlData>
</pkg:part>
</pkg:package>
And this is the result:
At least tha last paragraph is outside the content control.

Related

Ionic CLI - 6 Failed to load resource: the server responded with a status of 404 (Not Found)

`
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi#ionicframework.com" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:networkSecurityConfig="#xml/network_security_config" />
</edit-config>
<resource-file src="resources/android/xml/network_security_config.xml" target="app/src/main/res/xml/network_security_config.xml" />
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon#2x.png" width="114" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small#2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small#3x.png" width="87" />
<icon height="20" src="resources/ios/icon/icon-20.png" width="20" />
<icon height="40" src="resources/ios/icon/icon-20#2x.png" width="40" />
<icon height="60" src="resources/ios/icon/icon-20#3x.png" width="60" />
<icon height="48" src="resources/ios/icon/icon-24#2x.png" width="48" />
<icon height="55" src="resources/ios/icon/icon-27.5#2x.png" width="55" />
<icon height="29" src="resources/ios/icon/icon-29.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-29#2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-29#3x.png" width="87" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40#2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40#3x.png" width="120" />
<icon height="88" src="resources/ios/icon/icon-44#2x.png" width="88" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50#2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60#2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60#3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72#2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76#2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5#2x.png" width="167" />
<icon height="172" src="resources/ios/icon/icon-86#2x.png" width="172" />
<icon height="196" src="resources/ios/icon/icon-98#2x.png" width="196" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="960" src="resources/ios/splash/Default#2x~iphone.png" width="640" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="2048" src="resources/ios/splash/Default-Portrait#2x~ipad.png" width="1536" />
<splash height="1536" src="resources/ios/splash/Default-Landscape#2x~ipad.png" width="2048" />
<splash height="2732" src="resources/ios/splash/Default-Portrait#~ipadpro.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape#~ipadpro.png" width="2732" />
<splash height="1136" src="resources/ios/splash/Default-568h#2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" />
<splash height="2732" src="resources/ios/splash/Default#2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
</widget>
Ionic:
Ionic CLI : 6.11.0 (C:\Users\abhib\AppData\Roaming\npm\node_modules\#ionic\cli)
Ionic Framework : #ionic/angular 5.3.1
#angular-devkit/build-angular : 0.901.12
#angular-devkit/schematics : 9.1.12
#angular/cli : 9.1.12
#ionic/angular-toolkit : 2.3.0
Cordova:
Cordova CLI : not installed
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res (update available: 0.11.0) : 0.10.0
native-run : 0.3.0
System:
NodeJS : v12.18.3 (C:\Program Files\nodejs\node.exe)
npm : 6.14.6
OS : Windows 10
enter image description here`enter image description here
Ionic:
Ionic CLI : 6.11.0 (C:\Users\abhib\AppData\Roaming\npm\node_modules#ionic\cli)
Ionic Framework : #ionic/angular 5.3.1
#angular-devkit/build-angular : 0.901.12
#angular-devkit/schematics : 9.1.12
#angular/cli : 9.1.12
#ionic/angular-toolkit : 2.3.0
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (2 plugins total)
Utility:
cordova-res (update available: 0.11.0) : 0.10.0
native-run : 0.3.0
System:
NodeJS : v12.18.3 (C:\Program Files\nodejs\node.exe)
npm : 6.14.6
OS : Windows 10

Angular http client not working on ios device Ionic3

i need some help with my ionic projet.
I use Youtube Api to get a video Id and then open the video with InAppBrowser plugin.
It's works with my browser and the ionic dev app. But not when i build my ipa file and run it on my ios device.
My configuration :
Ionic:
ionic (Ionic CLI) : 4.7.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
#ionic/app-scripts : 3.2.1
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib#8.1.1)
Cordova Platforms : ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 3.1.2, (and 9 other plugins)
System:
ios-deploy : 1.9.4
NodeJS : v10.15.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61
My provider :
public fetchTrailer(mediaTitle: string) {
console.log("IN FETCH");
let searchText: string = mediaTitle + " bande annonce";
let url: string = YOUTUBE_API_URL +"search?maxResult=" +"1" +"&key=" +YOUTUBE_API_KEY +"&part=snippet&q=" +searchText;
console.log("URL " + url);
return new Promise (resolve => {
this.http
.get(
YOUTUBE_API_URL +
"search?maxResult=" +
"1" +
"&key=" +
YOUTUBE_API_KEY +
"&part=snippet&q=" +
searchText
).subscribe(
data => {
resolve(data);
},
err => {
console.log(err);
}
);
});
}
Xcode console error :
{"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":null,"ok":false,"name":"HttpErrorResponse","message":"Http failure response for (unknown url): 0 Unknown Error","error":{"isTrusted":true}}
Config.xml :
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="YouTubeDataApiKey" value="SECRET" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<allow-navigation href="*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon#2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40#2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40#3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50#2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60#2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60#3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72#2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76#2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5#2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small#2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small#3x.png" width="87" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="1136" src="resources/ios/splash/Default-568h#2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape#2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape#~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait#2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait#~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default#2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="2732" src="resources/ios/splash/Default#2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-sqlite-storage" spec="3.0.0" />
<plugin name="cordova-plugin-x-socialsharing" spec="5.4.4" />
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^3.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<plugin name="cordova-plugin-inappbrowser" spec="3.0.0" />
<plugin name="cordova-plugin-screen-orientation" spec="3.0.1" />
<engine name="ios" spec="4.5.5" />
</widget>
Thanks a lot

Ionic 1 http post failing

I am compiling an Ionic version 1 App to a device.
When I run ionic serve on the browser I can search and get a search result as the return.
I am using an http.post:
$http.post("http://www.example.com/myapi/mysearch.php", $scope.formData )
.success( function(data) {
After installing on the smartphone all I got is an error message (error).
I think this can be a lack of the whitelist cordova plugin, which I do remove and reinstall again.
Also have added:
<meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'">
To the index.html file.
How can I enable the apk to make post requests to the API?
Debugging from the real device using Chrome tools return this error message:
Failed to load http://www.myexample.com/api/myexampleapi.php:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
Here is my Ionic info:
Ionic:
ionic (Ionic CLI) : 4.1.2 (C:\Users\myuser\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic1 1.1.0
#ionic/v1-toolkit : 1.0.8
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : none
Cordova Plugins : not available
System:
NodeJS : v8.10.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 7
Environment:
This is my config.xml file:
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.ionic.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>MyApp</name>
<description>An awesome Ionic/Cordova app.</description>
<author email="hi#ionicframework" href="http://ionicframework.com/">Ionic Framework Team</author>
<content src="index.html" />
<access origin="*" />
<access origin="http://www.example.com/api/apiexample.php" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="android-minSdkVersion" value="19" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon#2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40#2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40#3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50#2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60#2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60#3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72#2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76#2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5#2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small#2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small#3x.png" width="87" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="1136" src="resources/ios/splash/Default-568h#2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape#2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape#~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait#2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait#~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default#2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<splash height="2732" src="resources/ios/splash/Default#2x~universal~anyany.png" width="2732" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^2.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
<engine name="browser" spec="^5.0.4" />
<engine name="android" spec="7.0.0" />
</widget>
To prevent this, you can use Cordova http plugin. It is the native way to make http calls (Cordova http plugin). Also you can check the same issue in the ionic 3 version in this answer

Anyway to remove white screen after splash screen

When on a slow connection, my Ionic app shows a white screen briefly on a slow connection. I am not importing any providers and the page does not have cordova plugins so it should not be an issue.
Is there any way to 100% remove this. What I was thinking, is to add an output to the pages the app can load on. When and event is emitted on ionViewDidEnter(), I hide the splash screen. This should hide the splash screen when the page is rendered.
Note that I have uncommented the service worker code in index.html and building as prod to create the necessary files.
What do you think?
EDIT: add config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.ionic" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>ionic</name>
<description>Ionic</description>
<author email="ionic#gmail.com" href="http://www.ionic.com/">Ionic</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
<icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
<icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
<icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
<icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
<icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
<splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
<splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
<splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
<splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
<splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
<splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
<splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
<splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
<splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
<splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
<splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
<splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="57" src="resources/ios/icon/icon.png" width="57" />
<icon height="114" src="resources/ios/icon/icon#2x.png" width="114" />
<icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
<icon height="80" src="resources/ios/icon/icon-40#2x.png" width="80" />
<icon height="120" src="resources/ios/icon/icon-40#3x.png" width="120" />
<icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
<icon height="100" src="resources/ios/icon/icon-50#2x.png" width="100" />
<icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
<icon height="120" src="resources/ios/icon/icon-60#2x.png" width="120" />
<icon height="180" src="resources/ios/icon/icon-60#3x.png" width="180" />
<icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
<icon height="144" src="resources/ios/icon/icon-72#2x.png" width="144" />
<icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
<icon height="152" src="resources/ios/icon/icon-76#2x.png" width="152" />
<icon height="167" src="resources/ios/icon/icon-83.5#2x.png" width="167" />
<icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
<icon height="58" src="resources/ios/icon/icon-small#2x.png" width="58" />
<icon height="87" src="resources/ios/icon/icon-small#3x.png" width="87" />
<splash height="1136" src="resources/ios/splash/Default-568h#2x~iphone.png" width="640" />
<splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
<splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
<splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
<splash height="1536" src="resources/ios/splash/Default-Landscape#2x~ipad.png" width="2048" />
<splash height="2048" src="resources/ios/splash/Default-Landscape#~ipadpro.png" width="2732" />
<splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
<splash height="2048" src="resources/ios/splash/Default-Portrait#2x~ipad.png" width="1536" />
<splash height="2732" src="resources/ios/splash/Default-Portrait#~ipadpro.png" width="2048" />
<splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
<splash height="960" src="resources/ios/splash/Default#2x~iphone.png" width="640" />
<splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
<splash height="2732" src="resources/ios/splash/Default#2x~universal~anyany.png" width="2732" />
</platform>
<preference name="webviewbounce" value="false" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashScreenBackgroundColor" value="0xFFFFFFFF" />
<preference name="SplashScreen" value="screen" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<icon src="resources/android/icon/drawable-xhdpi-icon.png" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<plugin name="cordova-plugin-console" spec="^1.1.0" />
<plugin name="cordova-plugin-device" spec="^1.1.7" />
<plugin name="cordova-plugin-geolocation" spec="^2.4.3">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value=" " />
</plugin>
<plugin name="cordova-plugin-network-information" spec="^1.3.4" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-sqlite-storage" spec="^2.1.2" />
<plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
<variable name="URL_SCHEME" value="ionic" />
<variable name="DEEPLINK_SCHEME" value="https" />
<variable name="DEEPLINK_HOST" value="ionic.com" />
<variable name="ANDROID_PATH_PREFIX" value="/" />
<variable name="ANDROID_2_PATH_PREFIX" value="/" />
<variable name="ANDROID_3_PATH_PREFIX" value="/" />
<variable name="ANDROID_4_PATH_PREFIX" value="/" />
<variable name="ANDROID_5_PATH_PREFIX" value="/" />
<variable name="DEEPLINK_2_SCHEME" value=" " />
<variable name="DEEPLINK_2_HOST" value=" " />
<variable name="DEEPLINK_3_SCHEME" value=" " />
<variable name="DEEPLINK_3_HOST" value=" " />
<variable name="DEEPLINK_4_SCHEME" value=" " />
<variable name="DEEPLINK_4_HOST" value=" " />
<variable name="DEEPLINK_5_SCHEME" value=" " />
<variable name="DEEPLINK_5_HOST" value=" " />
</plugin>
<plugin name="cordova-plugin-google-analytics" spec="^1.8.3" />
<plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^4.1.0">
<variable name="LOCATION_USAGE_DESCRIPTION" value="This app requires access to your location for navigation purposes" />
</plugin>
<plugin name="cordova-plugin-ionic-webview" spec="^1.1.16" />
<plugin name="cordova-plugin-camera" spec="^3.0.0" />
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0" />
<plugin name="cordova-plugin-badge" spec="^0.8.5" />
<plugin name="cordova-plugin-statusbar" spec="^2.3.0" />
<engine name="ios" spec="4.5.4" />
<engine name="android" spec="6.3.0" />
</widget>
[Solution] - Seems removing the splashscreen.hide() fixes the issue.
You need to decrease value of Fade Screen duration
<preference name="FadeSplashScreenDuration" value="300" />
and do below steps.
Remove platform : ionic cordova platform rm <android|ios>
Add platform : ionic cordova platform add >android|ios>
Run your app : ionic run <android|ios> --prod --device
Hope this will remove your white screen issue after splash.

NullPointerException when loading FXML file

So, Ive done it many times without problem and yet this time when I moved fxml and its controller from one project to another I cannot load it. Directory to fxml is fine, directory to controller in fxml file is also good, and I dont see why theres a problem to load it.
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.effect.*?>
<?import javafx.scene.text.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.layout.BorderPane?>
<BorderPane fx:id="borderPane" prefHeight="340.0" prefWidth="230.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.controller.tomaszm.SpokenNumbersController">
<center>
<Pane prefHeight="389.0" prefWidth="241.0" BorderPane.alignment="CENTER">
<children>
<Pane layoutY="233.0" prefHeight="75.0" prefWidth="244.0" style="-fx-background-color: linear-gradient( from 0.0% 0.0% to 100.0% 100.0%, rgba(255,255,255,0.1034482792019844) 0.0, rgba(241,255,20,0.2068965584039688) 100.0);">
<children>
<CheckBox layoutX="5.0" layoutY="55.0" mnemonicParsing="false" opacity="0.8" text="Test me when finished" />
<ToggleButton fx:id="toggbuttSTART" layoutX="5.0" layoutY="5.0" mnemonicParsing="false" onAction="#toggbuttSTARTAction" opacity="0.94" prefHeight="42.0" prefWidth="230.0" text="START">
<cursor>
<Cursor fx:constant="HAND" />
</cursor>
<effect>
<InnerShadow height="35.83" radius="21.119999999999997" width="50.65" />
</effect>
<font>
<Font name="System Bold" size="12.0" />
</font>
</ToggleButton>
</children>
</Pane>
<AnchorPane layoutY="145.0" prefHeight="88.0" prefWidth="245.0" style="-fx-background-color: linear-gradient( from 0.0% 0.0% to 100.0% 100.0%, rgba(255,255,255,0.10000000149011612) 0.0, rgba(6,56,255,0.30000000298023224) 100.0);">
<children>
<CheckBox fx:id="checkExtra" layoutX="5.0" mnemonicParsing="false" onAction="#checkExtraAction" opacity="0.96" prefHeight="23.0" prefWidth="230.0" text="Make extra breaks">
<padding>
<Insets bottom="15.0" left="4.0" top="1.0" />
</padding>
</CheckBox>
<Pane fx:id="breaksPane" disable="true" layoutY="32.0" prefHeight="56.0" prefWidth="230.0">
<children>
<ComboBox fx:id="comboboxEach" layoutX="5.0" layoutY="20.0" prefHeight="25.0" prefWidth="90.0" promptText="each" />
<ComboBox fx:id="comboboxExtraInterval" layoutX="116.0" layoutY="20.0" onAction="#checkExtraAction" prefHeight="25.0" prefWidth="90.0" promptText="interval" />
<Label layoutX="5.0" text="Cycle lenght:">
<font>
<Font name="System Italic" size="12.0" />
</font>
</Label>
<Label layoutX="116.0" layoutY="2.0" text="Delay:">
<font>
<Font name="System Italic" size="12.0" />
</font>
</Label>
</children>
</Pane>
</children>
</AnchorPane>
<AnchorPane prefHeight="68.0" prefWidth="245.0" style="-fx-background-color: linear-gradient( from 0.0% 0.0% to 100.0% 100.0%, rgba(255,255,255,0.10000000149011612) 0.0, rgba(255,0,0,0.22000000298023224) 100.0);">
<children>
<ComboBox fx:id="comboboxInterval" layoutX="5.0" layoutY="27.0" opacity="0.8" prefHeight="25.0" prefWidth="152.0" promptText="interval" AnchorPane.leftAnchor="8.0" />
<Label layoutX="5.0" layoutY="6.0" opacity="0.9" prefHeight="17.0" prefWidth="77.0" text="Interval:" AnchorPane.leftAnchor="7.0">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
</children>
</AnchorPane>
<Pane layoutY="68.0" prefHeight="77.0" prefWidth="247.0" style="-fx-background-color: linear-gradient( from 0.0% 0.0% to 100.0% 100.0%, rgba(255,255,255,0.10000000149011612) 0.0, rgba(48,213,48,0.30000000298023224) 100.0);">
<children>
<Slider fx:id="sliderCountdown" layoutX="2.0" layoutY="27.0" majorTickUnit="10.0" max="500.0" minorTickCount="0" prefHeight="37.0" prefWidth="179.0" showTickLabels="true" showTickMarks="true" snapToTicks="true" value="100.0" />
<Button fx:id="buttPlus" alignment="CENTER" layoutX="177.0" layoutY="25.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#buttPlusAction" prefHeight="31.0" prefWidth="31.0" style="-fx-background-insets: 4;" text="+" textFill="RED">
<font>
<Font size="14.0" />
</font>
</Button>
<Button fx:id="buttMinus" alignment="CENTER" layoutX="201.0" layoutY="25.0" minHeight="-Infinity" minWidth="-Infinity" mnemonicParsing="false" onAction="#buttMinusAction" prefHeight="31.0" prefWidth="31.0" style="-fx-background-insets: 4;" text="–" textFill="RED">
<font>
<Font size="14.0" />
</font>
</Button>
<Label layoutX="5.0" layoutY="6.0" opacity="0.9" prefHeight="17.0" prefWidth="74.0" text="Countdown:">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
<Label fx:id="labCountdown" layoutX="81.0" layoutY="6.0" opacity="0.9" text="100" textFill="RED" />
</children>
</Pane>
<Separator layoutY="310.0" opacity="0.5" prefHeight="3.0" prefWidth="241.0" />
</children>
</Pane>
</center>
<top>
<MenuBar BorderPane.alignment="CENTER">
<menus>
<Menu mnemonicParsing="false" text="Options">
<items>
<Menu mnemonicParsing="false" text="Language">
<items>
<RadioMenuItem fx:id="radiomenuPolish" mnemonicParsing="false" onAction="#selectLanguageAction" selected="true" text="Polski">
<toggleGroup>
<ToggleGroup fx:id="languageGroup" />
</toggleGroup>
</RadioMenuItem>
<RadioMenuItem fx:id="radiomenuEnglish" mnemonicParsing="false" onAction="#selectLanguageAction" text="English" toggleGroup="$languageGroup" />
<RadioMenuItem fx:id="radiomenuDeutsch" mnemonicParsing="false" onAction="#selectLanguageAction" text="Deutsch" toggleGroup="$languageGroup" />
<RadioMenuItem fx:id="radiomenuChinesse" mnemonicParsing="false" onAction="#selectLanguageAction" text="Chinesse" toggleGroup="$languageGroup" />
</items>
</Menu>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
</top>
<bottom>
<HBox opacity="0.6" prefHeight="10.0" prefWidth="241.0" BorderPane.alignment="CENTER">
<children>
<Label prefHeight="4.0" prefWidth="74.0" text="Counted digits: ">
<font>
<Font name="Cambria" size="11.0" />
</font>
</Label>
<Label fx:id="labNumber" prefHeight="14.0" prefWidth="73.0" text="0">
<font>
<Font name="Cambria" size="11.0" />
</font>
</Label>
</children>
</HBox>
</bottom>
</BorderPane>