Giter VIP home page Giter VIP logo

nativescript-ionic-template's Introduction

NativeScript Ionic Template {N} apple android ionic

Native mobile Apps with NativeScript and Web Apps (Mobile First) with Ionic styles and components sharing the same code with Angular!

This template uses the default navigation of Angular, the navigation of Ionic 3 is not recommended to develop websites, therefore it is not recommended to use Ionic components that require Ionic navigation. However, in this template you can find an example of how to use components such as the side menu without depending on the navigation.

NativeScript and Ionic

Introduction ๐Ÿ‘จโ€๐Ÿ’ป

Using this template you can create a Web App (Mobile First) using Ionic 3 components and a Mobile Native App using NativeScript with the same code, yay! ๐Ÿ‘

Native and Web Grid

For more details you can check the excellent NativeScript team article about Code Sharing Between Web and Mobile with Angular and NativeScript: https://www.nativescript.org/blog/code-sharing-between-web-and-mobile-with-angular-and-nativescript

How does it work? โ˜•

Check the excellent video of Sebastian Witalec about Sharing Code Between Web and Native Apps

Sharing Code Between Web and Native Apps

Run the projects โฏ

  • Ionic Web App (Using the Angular-cli):
  npm install (It's required to create the symlinks at the first time before to execute the app)
  ng serve
  • NativeScript Mobile App:
  cd nativescript
  npm install
  npm run livesync (Required to detect changes and reload the app from the simulator/device)
  npm run ios (using other terminal)

Commands ๐Ÿ’ป

View available commands here: Seed commands

Getting Started ๐Ÿ“š

Command Action
npm install -g @angular/cli Install the Angular-cli. Remember see the documentation here
ng g module [name] Generate a new Module. Recommended to create sections of your app that will load components with Lazy Loading.
ng g component [name] Generate a new Component in the current directory. Remember add the moduleId property moduleId: module.id in every component
ng g service [name] Generate a new Service. The app/providers/ path is recommended for shared services among several components.

Use Ionic icons from the NativeScript side ๐ŸŽ

NativeScript requires the unicode of the icon, you can find the unicode with the name of the icon from the content of the src/fonts/ionicons.svg file and later you can use it from a <Label> or <Button>, example:

// name: ion-ios-contact, unicode: &#xf41a;
<Button class="ion-icon" fontSize="25" text="&#xf41a;"></Button>

Custom templates for each platform ๐Ÿฅ‚

Target Phone and Tablet Templates individually. The following extensions are supported:

Extension Platform
.{html/scss} Web platform. Used from mobile when there is no .tns extension
.tns.{html/scss} Only for mobile
.tns.ios.{html/scss} Only for iOS
.tns.android.{html/scss} Only for Android
.tns.ios.phone.{html/scss} Only for iOS Phone
.tns.android.phone.{html/scss} Only for Android Phone

Code Splitting

Angular Tips

Syntax ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  Meaning Expected Result
{{ title }}
{{ getTitle() }}
Render a value dynamically, this expression will be evaluated at run time.
[src]="imageUrl" ย  ย  ย  ย  ย  ย  Property Binding: Bind a property of a DOM element to a field of the component.
[attr.colspan]="colSpan" ย  ย  ย  Attribute Binding
[class.selected]="user.selected" Class Binding: Add a class dynamically.
[style.color]="isActive? 'green': 'red'" Style Binding
(tap)="onSave($event)"ย  ย  ย ย  ย  Event Binding
(keyup.enter)="onEnter()" ย  ย  ย  Event Filtering
#email (keyup.enter)="onEnter(email.value) Template variables
[(ngModel)]="user.email" ย  ย  ย  Two-way Binding. Import FormsModule is required.
{{ price | currency:'AUD' }} ย  Pipes: Format data.
@Input('input-property') myData;
<example [input-property]="data">
Input Properties: Input data for the component.
@Output('output-property') change= new EventEmitter();
this.change.emit({msg: 'Hi!'});
<example (output-property)="onChange($event)">
Output Properties: Raise events from the component. onChange({msg})
{
console.log(msg)
}

Resources โ›ฉ

Contributors ๐Ÿฅ‡

Sean perkins jdnichollsc
Sean Perkins Juan Nicholls

Credits ๐Ÿ‘

Supporting ๐Ÿป

I believe in Unicorns ๐Ÿฆ„ Support me, if you do too.

Happy coding ๐Ÿ’ฏ

Made with โค๏ธ

nativescript-ionic-template's People

Contributors

jdnichollsc avatar

Watchers

James Cloos avatar Wendel G. Santana avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.