Integrating NativeScript with Angular 2.
Running locally
Prerequisites
Install your native toolchain and NativeScript as described in the docs:
https://docs.nativescript.org/setup/quick-setup
Install dependencies
$ npm install -g gulp
Then install the needed NPM packages:
$ cd nativescript-angular
$ npm install
Run the sample application (ng-sample)
Install NPM packages (use the local copy of nativescript-angular
):
$ cd ng-sample
$ npm install
$ npm install ../nativescript-angular
Start the 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
Install NPM packages (use the local copy of nativescript-angular
):
$ cd tests
$ npm install
$ npm install ../nativescript-angular
Start test run:
$ tns test ios --emulator
$ tns test android --emulator
Developer workflow:
Setup:
Use npm link
to link nativescript-angular
in tests
and ng-sample
progects:
cd nativescript-angular
npm link
cd ../ng-sample
npm link nativescript-angular
cd ../tests
npm link nativescript-angular
Work
- Make changes to the
test
,ng-sample
projects or innativescript-angular
folder. - Run the
tests
orng-sample
using as shown above.
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
- There are certain issues with the Parse5DomAdapter and we'll likely need to provide our own later on: