9

Is it possible to connect MySql db using angularjs without PHP code? based on client side scripting we can't connect MySql db. Is it any other way to connection?

3
  • 1
    why do you want to access mysql db using the client script.My suggestion would be create a web services in the PHP & consume it in the angular js. Commented Aug 5, 2015 at 11:18
  • There are hosted JavaScript services that will let you store data without needing to write server-side code yourself. I believe Firebase does this, but you then relinquish control/hosting of the data entirely (that can be both a good and a bad thing). Commented Aug 5, 2015 at 11:20
  • One of my student asked this. i'll try firebase.. thank for your answer .. Commented Aug 6, 2015 at 7:56

3 Answers 3

10

If you wish to use just Angular for accessing your database, then discard PHP all together, and switch to something like Firebase. It will allow you to do almost everything from your Angular application (not saying that you should do it that way, but you could).

AngularJS is a Front-end framework, and it should be used in combination with some server side language: Java/C#/NodeJS/PHP...

But to answer your question directly: No, you can't access MySQL from Angular.

Sign up to request clarification or add additional context in comments.

1 Comment

You could also try using an embedded database such as SQLite for a relational database or an alternative for NoSQL databases.
1

No, you cant connect MySql DB(Backend) with any client side javascript libraries so cant connect Backend DB with angularjs.

You can pick any server side programming language(not only php) to access MySql DB and write webservice interface to pass data from backend to your client.

If you are willing to have a db at client side which can be accessed with javascript(even angularjs) and no need to use any server side programming language then can go with below methods:

Indexed Database
Web SQL
localStorage 

Comments

0

As of now we can't connect to our DB through client script. But there is alternate solution to store your data in google's FIREBASE https://www.firebase.com/tutorial/#session/omykpz5lraw.

This can be done by using nodejs as server to connect to ur database(I have done it using MangoDB). Since Angular js follows MVC architecture, you can use it as service layer too.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.