Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example project to demonstrate TypeORM in an Ionic app

NotificationsYou must be signed in to change notification settings

typeorm/ionic-example

Repository files navigation

You can use TypeORM in connection with thecordova-sqlite-storage plugin in your Ionic app.This project demonstrates how that would work.

Installation

To run this example in production or development mode you have to make sure,ionic andcordova are installed globally on your machine. After that you can install all necessary dependencies for running this example.

  1. Check ifnpm is installed. Otherwise pleaseinstallnode.js andnpm.
npm -v
  1. Install ionic and cordova command line interface globally.
npm install -g cordova ionic
  1. Install all dependencies listed inpackage.json.
npm install

Running the example in your browser

ionic serve

Running the example on your device

  1. Add an iOS or Android to the project.
ionic cordova platform add ios# orionic cordova platform add android
  1. Run the app on your device.
ionic cordova run ios# orionic cordova run android

For further information please readionic's deployment guide.

screenshot

Using TypeORM in your own app

  1. Install the plugin
ionic cordova plugin add cordova-sqlite-storage --save
  1. Install TypeORM
npm install typeorm --save
  1. Install node.js-Types
npm install @types/node --save-dev
  1. Add"typeRoots": ["node_modules/@types"] to yourtsconfig.json undercompilerOptions

  2. Create a custom webpack config file like the oneincluded in this project to use the correct TypeORM version and add the config file to yourpackage.json (Required with TypeORM >= 0.1.7)

Limitations to TypeORM when using production builds

Since Ionic make a lot of optimizations while building for production, the following limitations will occur:

  1. Entities have to be marked with the table name (eg@Entity('table_name'))

  2. getRepository() has to be called with the name of the entity instead of the class (eggetRepository('post') as Repository<Post>)

  3. Date fields arenot supported:

@Column()birthdate:Date;

About

Example project to demonstrate TypeORM in an Ionic app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors6


[8]ページ先頭

©2009-2025 Movatter.jp