R
R
Roman Volkov2015-02-17 09:22:06
Angular
Roman Volkov, 2015-02-17 09:22:06

How to work with the database in AngularJS?

I want to create a game in Angular JS, but before I start, I would like to know how you can store information about games. For example, a table of records?
1) The first thing that comes to mind is to store in the database, but I don't know how Angular can work with the database. Using ajax to send a request to a script that will write to the database?
2) Store data in cookies?
3) How else can you store data in agnular?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-02-17
@white_wolf_17

1) Yes, in the base of norms. Between the angular and the base there will be a REST Api. If there is no desire to create a backend for your application, there are services like mongolab that provide access to mongo via REST.
2) Don't do it. Only as a fallback if the user does not have localStorage.
3) REST -> anywhere, WebStorage/LocalStorage/SessionStorage, IndexedDB

A
aen, 2015-02-17
@aen

Angular.js is just a client-side framework. It does not know how to store data. At best, there are a couple of wrappers for it over cookies or localStorage, which in your case is probably not the best option.
You need a server side. Take any server language, write code to work with the database.

U
Unknown Hero, 2015-02-17
@UnknownHero

You need an API.
If you don't know server languages ​​and technologies, choose nodejs.
Also for this platform there are convenient ORMs for working with the database, for example, sequelizejs.com
I can also advise you to take a ready-made framework - loopback.io , sailsjs.org/#!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question