A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/betov18x/nativescript-angular-typeorm-example below:

betov18x/nativescript-angular-typeorm-example: Example of TypeORM with Nativescript-Angular

Nativescript-Angular Integration with TypeORM

As you can see the task list is persisted even when the app is killed and reopened.

import {createConnection, getManager} from "typeorm/browser";
import Todo from './models/Todo';
//driver
let driver = require('nativescript-sqlite');

(async () => {
    try {
        const connection = await createConnection({
            database: 'test.db',
            type: 'nativescript',
            driver,
            entities: [
                Todo
            ],
            logging: true
        })

        console.log("Connection Created")

        // setting true will drop tables and recreate
        await connection.synchronize(false) 

        console.log("Synchronized")


    } catch (err) {
        console.error(err)
    }
})();

Visit https://github.com/typeorm/nativescript-vue-typeorm-sample to see step by step how to do this, just keep in mind you have to do the connection like this to make it work with Angular. This was based on his example.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4