hi guys, I can’t find a solution or an example, a real example of how to get mysql data with php and Emberjs 3, I have no idea, I start to think that Ember js is a waste of time compared to Vuejs because I can find everything i need from video examples etc, if anyone can help with an example from scratch, i just want to list delete things from server. I apologize for my sincerity and I appreciate any help
Hi @TAFAPP_Fabrica_App, sorry this has been frustrating for you. Have you tried following along with the official guides or the official tutorial? I will grant you there probably isn’t a ton of early level video content with Ember that is kept up to date.
At a high level data fetching with Ember and Vue are going to look pretty similar. Going further into data management, like CRUD operations, Ember’s default data layer (Ember Data) is pretty robust and very easy to use for common cases. I’m not sure what the Vue equivalent of that would be, or if there even is one. But even Ember Data uses the same concepts, it just abstracts a lot of the boilerplate away.
Anyway, at the highest level you’re probably going to fetch data via AJAX (with Fetch/XHR) and then display the data. In Ember this is often done in a “route”. You can fetch data in components also but I’d recommend a route because it simplifies things considerably (routes take care of all of the async concerns for you as well as help you define your URL structure for your app). The most basic route will return some sort of data fetch promise from its model hook, which is then injected into the route controller (automatically if you don’t define one) and can then be displayed in the route’s template. The template can either pass that data on to components or render it right there.
Since you’re focused on data loading from PHP I would start with the guide pages on:
That should get you up and running with defining a route, using it to fetch data, and rendering it in the route template. From there it would make sense to move on to components.
If you’re also starting out with PHP, well… I can’t personally recommend any great resources for that though I’ve heard great things about Laravel. Essentially you probably want your server to provide a standard RESTful API. Ember Data plays nicely with pretty much any backend format, but it will work smoothest with JSON:API compliant backends so if there are plugins/libraries for that it may speed you along.
Anyway, that’s sort of a broad question so unfortunately the answer is pretty broad as well, but hopefully some of that will help, and if you get stuck or have any more questions feel free to ask and we’ll try and help you along!