FrankTby
FrankTby

Reputation: 37

NativeScript with Angular2's UI doesn't support mobile client?

I'm learning developing cross-platform mobile-client app with nativescript. It turns out the UI component is extremely limited in nativescript and everytime I try to learn the official document, it leads me to angular2 docs. I know, nativescript uses angular2, but the examples in angular doesn't work on mobile client?

For example: template: <button (click)="onClickMe()">Click me!</button> this kind of code can only work for web-app, it doesn't support the nativescript mobile client development, it can complie but there is nothing display, the formatting is somehow different:

<Button (tap)="onClickMe()" text="!" ></Button>

The above code is the code I'm looking for. But I can't find documents that tells me how to transfer between them. All the documents I found is about the first code.

I'm really struggling with this, I can't even find "radioButton" for mobile client:(

Just wanna know why the first code can't work on my ios simulator for the mobile app but the second one can? Aren't they all typescipt?

I'm new to this so maybe my question is dumb~~

Thank you for your patience!

Upvotes: 0

Views: 78

Answers (1)

Eddy Verbruggen
Eddy Verbruggen

Reputation: 3550

When using NativeScript with Angular you're not supposed to share the view layer with a browser version of the app. In fact that's (almost the) only thing you'll need to implement twice.

Please look at the docs to see how you create the UI components: https://docs.nativescript.org/angular/ui/components.html

Regarding radio buttons.. I have yet to see a radio button in a native app. Usually apps use switches and list pickers as they're easier to operate than radio buttons.

If you want to share lots of code between your mobile app and browser version (and possibly even a desktop version) then I'd highly recommend this seed as a starting point for your app: https://github.com/NathanWalker/angular-seed-advanced

If you just want to learn more about how NativeScript uses Angular, follow this tutorial: http://docs.nativescript.org/angular/tutorial/ng-chapter-0

Upvotes: 4

Related Questions