Add Angular2 Material to Nativescript
Asked Answered
L

1

5

I've created a basic Nativescript app using: tns create my-project-name --template nativescript-angular-drawer-template

Now, I want to add Material Design to my app. According to the docs I ran the command npm install --save @angular/material and added the MaterialModule as per the docs. But my app giving errors of

Error finding module function

Any Idea?

Libbi answered 31/1, 2017 at 7:26 Comment(0)
S
15

You won't be able to run material directly in nativescript because there is no DOM with nativescript unless you show a webview inside the native app. However with native android you don't need a library to get material design because it's where Google defines material so it's just native components. There are many plugins for several widgets because they don't belong in the nativescript core because they aren't cross platform, this is where many of the plugins use a native iOS library to make the nativescript plugin cross platform. A lot of this might be confusing :)

Here's one plugin https://github.com/bradmartin/nativescript-cardview for the material design cardview, this is native to Android via a library from Google that most apps ship with. Since iOS doesn't follow material design, we recently had a nice PR for the iOS side that just uses the native iOS UI controls to provide a similar looking UI component. Again, if you're unfamiliar with any of this I might be making it more confusing. If you need help or have questions a nativescript forums and slack channel are great to hang out in and get help from NS devs. Ping me there if you need something

Stretchy answered 31/1, 2017 at 8:15 Comment(3)
Is there any plugin for tab-view? Currently using the default TabViewLibbi
The tabview in core is the native tabview. Not sure I understand what you are referring to. If you mean the new material bottom navigation then yes there is a plugin for that which uses a third party android lib. Plugins should be listed on plugins.nativescript.org, a new plugin hub just opened yesterday I believe to make finding plugins easier.Stretchy
> However with native android you don't need a library to get material design So why do i need to install plugins?Orometer

© 2022 - 2024 — McMap. All rights reserved.