Code Monkey home page Code Monkey logo

nativescript-angular's Introduction

Build Status

Integrating NativeScript with Angular 2.

Running locally

Get submodule code

The project bundles the NativeScript modules and Angular as source code dependencies set up as git submodules. You need to get them by running:

$ git submodule update --init

Prerequisites

Install your native toolchain and NativeScript as described in the docs:

https://docs.nativescript.org/setup/quick-setup

Install dependencies

$ npm install -g grunt-cli gulp

Then install the needed NPM packages:

$ npm install

Compile and prepare NativeScript and Angular

$ grunt

Initialize the test NativeScript app (ng-sample)

$ cd ng-sample
$ npm install

The latter installs the angular2 and tns-core-modules packages that you just built by running grunt prepare step in the project root.

Run the ng-sample app

$ tns run android
$ tns run ios

(Optional) Webpack bundling

Install the webpack tool:

$ npm install -g webpack

Enable the webpack hook by setting the WEBPACK_BUILD environment variable. You can do it with a single command on OSX/Linux using:

$ env WEBPACK_BUILD=1 tns run android

Running the tests

$ cd tests
$ npm install
$ tns test ios --emulator

Developer workflow:

  1. Make changes to src/nativescript-angular, and rebuild with grunt build. If succesful, you should get a npm package in the project root.
  2. Navigate to the ng-sample subdir: $ cd ng-sample. Make some changes to the app or ../src/nativescript-angular.
  3. Run with $ tns run android or $ tns run ios

Note that you should never change files in ng-sample/src/nativescript-angular/ as they are overwritten with the reference sources in src/nativescript-angular on every grunt app run.

Watch the video explaining Angular 2 and NativeScript

NativeScript session on AngularConnect conference

Explore the examples

The ng-sample app is meant for testing stuff while developing the renderer code, and isn't the best example out there. You can take a look at these sample apps that use the published builds from npm:

Known issues

  1. There are certain issues with the Parse5DomAdapter and we'll likely need to provide our own later on:
  • Self-closing elements (<Label text="Name" /><Button text="Save" />) get parsed wrong (in this case Button gets parsed as a Label child.

nativescript-angular's People

Contributors

erjangavalji avatar hdeshev avatar nathanwalker avatar pbartrina avatar vakrilov avatar

Watchers

 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.