From 909c18d9e64119cc3d4d248f81d4cf8d8199517c Mon Sep 17 00:00:00 2001 From: Martin Hettiger Date: Thu, 26 Oct 2017 10:40:37 +0200 Subject: [PATCH 1/2] Add some additional required installation steps to the readme For me the WebImage tag would not work correctly on iOS without registering the module in my main.ts file. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 41ea8a4..8d70903 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,14 @@ Released under the MIT License, anybody can freely include this in any type of p initializeOnAngular(); } } + +Next step is to register the module within your `app/main.ts` file right before the `bootstrapModule()` call: + + import * as elementRegistryModule from 'nativescript-angular/element-registry'; + elementRegistryModule.registerElement("WebImage", () => require("nativescript-web-image-cache").WebImage); + + platformNativeScriptDynamic().bootstrapModule(AppModule); + After initialisation, the markup tag `` can be used in templates of components. From 787e4626687afc8a3d80ad2eb9d54121868407fd Mon Sep 17 00:00:00 2001 From: Martin Hettiger Date: Thu, 26 Oct 2017 11:34:27 +0200 Subject: [PATCH 2/2] Make the installation step conditional for iOS because it would crash on Android --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d70903..3ecf9e6 100644 --- a/README.md +++ b/README.md @@ -24,10 +24,14 @@ Released under the MIT License, anybody can freely include this in any type of p } } -Next step is to register the module within your `app/main.ts` file right before the `bootstrapModule()` call: +For iOS you also need to register the module within your `app/main.ts` file right before the `bootstrapModule()` call: + import { isIOS } from "tns-core-modules/platform"; import * as elementRegistryModule from 'nativescript-angular/element-registry'; - elementRegistryModule.registerElement("WebImage", () => require("nativescript-web-image-cache").WebImage); + + if (isIOS) { + elementRegistryModule.registerElement("WebImage", () => require("nativescript-web-image-cache").WebImage); + } platformNativeScriptDynamic().bootstrapModule(AppModule);