Nativescript 6 with Angular 10

[Reminder] With Nativescript 7 released, this article is now meaningless.

Sources:

As of August 28, 2020, standard installation produce an angular 8 application.

The purpose of this article is to generate a functional application with angular 10.

Install NativeScript release candidate

npm i -g [email protected]

Generate a hello-world application

nsc create sampleapp –template @nativescript/template-hello-world-ng

use SASS by default

  1. install node-sass :
    npm i --save-dev node-sass
  2. rename app.css in app.scss
  3. replace in app.scss :
@import "[email protected]/theme/css/core.css";
@import "[email protected]/theme/css/default.css";

by

@import "[email protected]/theme/core";
@import "[email protected]ipt/theme/default";
  1. change in angular.son
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "cli": {
    "defaultCollection": "@nativescript/schematics"
  },
  "projects": {
    "hello-world": {
      "root": "",
      "sourceRoot": "src",
      "projectType": "application",
      "prefix": "ns",
      "schematics": {
        "@nativescript/schematics:component": {
          "style": "scss"
        }
      }
    }
  },
  "defaultProject": "hello-world"
}

Add a login page

ng generate component login
ng generate service services/user
ng generate class models/user --type=model

Test your application

nsc run ios –emulator

Laisser un commentaire

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.