nativescript-angular icon indicating copy to clipboard operation
nativescript-angular copied to clipboard

Angular 9

Open simkepal opened this issue 7 years ago • 37 comments

Hello,

I have a question: Is there already something to test out NativeScript with Angular 9? I am building an app for web, which will go out in December and thinking about to have also mobile app.

Thanks for answer!

simkepal avatar Nov 09 '19 11:11 simkepal

Hi @simkepal ,

Thank you for the interest of Angular 9 and its integration in NativeScript. We have been working closely with the Angular team in order to make sure that the Ivy feature of the Angular 9.0.0 release will be available in NativeScript with as little requirements as possible. While the story about Ivy is still not fully functioning in NativeScript we have resolved all other changes and compatibility requirement that come with Angular 9.0.0.

You can test an early version of the nativescript-angular package that is build agains the 9.0.0-rc.1 version of Angular by using the ivy tag of the package which is now available in npm.

As already mentioned the Ivy functionality is still in development and is currently not working so you will have to disable it. After installing the nativescript-angular@ivy package and running the dependencies update script (./node_modules/.bin/update-app-ng-deps) because Angular 9.0.0 comes with Ivy enabled by default you have to disable it by placing this in the app's tsconfig.json:

"angularCompilerOptions": {
      "enableIvy": false
}

Note that this is an very early "preview" of the nativescript-angular package integration with Angular 9.0.0, if you notice any issue please report them here.

VladimirAmiorkov avatar Nov 12 '19 15:11 VladimirAmiorkov

Hi, thanks for your work. Could you tell me when Angular 9 support for Nativescript is expected? Angular 9 has been officially released.

samirotiv avatar Feb 07 '20 06:02 samirotiv

I am also looking forward to Angular 9. Especially components such as the google maps component will be great too use: https://github.com/angular/components/tree/master/src/google-maps

flodaniel avatar Feb 07 '20 21:02 flodaniel

To me the most exciting thing about Angular 9 is it supports TypeScript 3.7, with optional chaining. Looking forward to cleaning up a bunch of code as soon as this is ready. 😀

BenSjoberg avatar Feb 08 '20 00:02 BenSjoberg

Crap upgraded angular on a large project with a web site and an app and the Nativescript side is broken.

Any ideas on when NativeScript will work again?

MattRiddell avatar Feb 09 '20 02:02 MattRiddell

Ok cool after actually RTFM I can confirm it is working with the following steps:

npm i nativescript-angular@ivy  
./node_modules/.bin/update-app-ng-deps
npm i

MattRiddell avatar Feb 09 '20 02:02 MattRiddell

Unfortunately my application doesn't work after migration to Angular 9. The web application works well, but in ns app I have a lot of bugs during the launch.

I tried to create new empty code-sharing project and then migrating to ng 9 with the same results :(. Finally I can't migrate my web app to ng 9 because of that.

plackowski avatar Feb 12 '20 21:02 plackowski

I've tried to upgrade Nativescript Hello world application to angular 9 with nativescript-angular@ivy but I've ended with error

ERROR in Symbol TextValueAccessor declared in C:/DATA/Repo/sandbox/nativescript-ivy/node_modules/@nativescript/angular/forms/value-accessors/text-value-accessor.js is not exported from C:/DATA/Repo/sandbox/nativescript-ivy/node_modules/@nativescript/angular/forms/value-accessors/text-value-accessor (import into C:/DATA/Repo/sandbox/nativescript-ivy/node_modules/@nativescript/angular/forms/forms.module.js)

Does anybody know what might be the problem?

vinckobb avatar Feb 17 '20 11:02 vinckobb

@vinckobb @Arystosedes @BenSjoberg @samirotiv @Firetrip Give this a shot: https://github.com/NativeScript/nativescript-angular/pull/2124#issue-376409005

NathanWalker avatar Feb 18 '20 06:02 NathanWalker

@NathanWalker I've tried your PR but still same error. Created repo with your version of nativescript angular so you can try https://github.com/vinckobb/nativescript-angular-demo

vinckobb avatar Feb 18 '20 17:02 vinckobb

Thanks @vinckobb that's super helpful! I'll give it shot and see if some subtle project setup issue may be getting in way with what you got there. I'll have chance to take peek on Wednesday.

NathanWalker avatar Feb 18 '20 18:02 NathanWalker

@vinckobb here ya go: https://github.com/vinckobb/nativescript-angular-demo/pull/1

NathanWalker avatar Feb 20 '20 03:02 NathanWalker

@NathanWalker tried your PR but still same error while compiling with ngcc. I'm using Windows right now so it can be Windows related. I'll try os x in the evening.

So it definitely looks like Windows related problem. It works like a charm on OS X. I'm going check what might be the problem. Thanks a lot @NathanWalker

vinckobb avatar Feb 20 '20 07:02 vinckobb

@vinckobb my guess is likely Windows has issue with the postinstall handling and/or ngcc trying to compile node_modules and runs into path/directory issue possibly. Lemme know if you find what is affecting Windows.

Thanks for letting us know Mac/OS X worked for you 👍

NathanWalker avatar Feb 23 '20 05:02 NathanWalker

@NathanWalker I had to explicitly list exported names in form/value-accessor to make it work on Windows as you can see in https://github.com/vinckobb/nativescript-angular/commit/4eb895fe157678b68cbec7f6024f56afcc452e58

Don't know why I had to do this for this particular index.ts because http-client works without any problems.

vinckobb avatar Feb 25 '20 09:02 vinckobb

@vinckobb did you compile your own version of nativescript-angular with this change?

joshcomley avatar Feb 29 '20 17:02 joshcomley

@joshcomley yes I did. I've updated my repo https://github.com/vinckobb/nativescript-angular-demo with compiled version of nativescript-angular that is working on Windows.

You can compile it yourself if you want. Clone or fork nativescript-angular repo, go to nativescript-angular directory and run command npm run pack. It will create .tgz file in dist repo in main directory.

vinckobb avatar Feb 29 '20 17:02 vinckobb

@vinckobb this pr has been updated with your export changes as well: https://github.com/NativeScript/nativescript-angular/pull/2124

NathanWalker avatar Mar 02 '20 04:03 NathanWalker

@joshcomley @vinckobb for ease I posted the compiled working v9 versions to a repo - these include the fix to exports for windows as well, just set your package.json to the following:

"@nativescript/angular": "https://github.com/nstudio/ns-ng/blob/master/nativescript-angular-9.0.0.tgz?raw=true",
"nativescript-angular": "https://github.com/nstudio/ns-ng/blob/master/nativescript-angular-compat.tgz?raw=true"

Then reference the notes made here regarding tsconfig and other details for Ivy compliance: https://github.com/NativeScript/nativescript-angular/pull/2124#issue-376409005

NathanWalker avatar Mar 02 '20 05:03 NathanWalker

@vinckobb i pushed another fix to that PR that may have also been affecting forms and similar to what you had mentioned on windows. With this final adjustment I’m seeing stable Ivy behavior: https://github.com/NativeScript/nativescript-angular/pull/2124/commits/35e4864e2d53926b184285c1e79661640af67ed1

The latest remote tgz’s provided here have all latest fixes:

"@nativescript/angular": "https://github.com/nstudio/ns-ng/blob/master/nativescript-angular-9.0.0.tgz?raw=true",
"nativescript-angular": "https://github.com/nstudio/ns-ng/blob/master/nativescript-angular-compat.tgz?raw=true"

NathanWalker avatar Mar 07 '20 19:03 NathanWalker