Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add Angular2 Material to Nativescript

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?

like image 345
Emu Avatar asked Jan 31 '17 07:01

Emu


1 Answers

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

like image 196
Brad Martin Avatar answered Nov 06 '22 00:11

Brad Martin