I recently got moved to the Ember team at work and these tutorials are a life saver. Thanks for the great work!
@ScottBatson6 жыл бұрын
Thanks for watching! Remember to swing by the Ember slack or discuss.emberjs.com/ if you have questions as you're ramping up with Ember.
@indiaengineering8 жыл бұрын
I love you scott. You won't believe but I watch your first video 3 full times. It's great. Please don't stop making these videos. You're my EmberHero.
@ScottBatson8 жыл бұрын
+arpit shah Thanks! That means a lot! Let me know if there are any Ember topics you'd like me to cover in the future (I'm just winging it).
@indiaengineering8 жыл бұрын
+Scott Batson Thanks a lot :) Relationships, Helpers, Debugging Strategies, Authorization. Thanks again for your efforts.
@uitrev5 жыл бұрын
Update - I've used this tutorial on Ember 3 and it works perfectly fine (so far). Good stuff!
@iliyaokner40735 жыл бұрын
Thank you for the update, Good to know this video is not outdated due to newer versions of ember
@kirankothandan55293 жыл бұрын
I am just running into ember data for first time. Your lecture is just excellent and very informative. Thank you very much.🙏🙏🙏
@ScottBatson3 жыл бұрын
Thanks for watching! Even if it is 5 years out of date
@alexandreformagio19097 жыл бұрын
Thank you Scott. Very well explained, you went a little deeper in serializers and adapters, that is very important in situations where we don't have control over responses coming from the backend. Using justt one word to describe your video, FANTASTIC !!!
@squirecd7 жыл бұрын
By far the best tutorial I've found in 3 weeks. Thanks!
@ScottBatson7 жыл бұрын
Thanks for watching!
@odpJatoUnitRecs8 жыл бұрын
This was a really helpful walkthrough, thanks for making my baby steps into ember digestible
@WilmanArambillete7 жыл бұрын
Amazing tutorial! Not only very clear but also showing very useful tricks and common errors we might bump into. Thanks a lot!
@ScottBatson7 жыл бұрын
Thanks for watching!
@PeterParker-sy9bp7 жыл бұрын
Hey Scott.Thank you so much for this perfectly explained tutorial.This is the best explanation on the internet for Adaptar/Serializer by far.Your teaching style is a perfect fit for starters. Thank you so much for all the lessons you teach.Solid resource :)
@ScottBatson7 жыл бұрын
Thanks for watching!
@lomodevaca8 жыл бұрын
Hey man, just wanted to say thanks for the great turorial!. It really helped me a lot connecting my flask-api with ember. I was trying to do this for a couple of weeks now and you just made everything easy with your explanations. As I said before good work and keep them coming.
@mdrahman14447 жыл бұрын
You did a very good job Scott; Keep sharing your wisdom and thoughts.
@almost51987 жыл бұрын
The best tutorial on Ember.js out there, atleast for me .
@ScottBatson7 жыл бұрын
Thanks for watching!
@eternal50245 жыл бұрын
Great video, I feel equipped to start digging into deeper Ember data API's. Thanks a million.
@richardurena58676 жыл бұрын
Great video! It has just what I needed and more of what I will need in the future!
@ghoshnirmalya8 жыл бұрын
Very nice video. It would be really helpful if you could do any screencast on authentication!
@timomuller76098 жыл бұрын
This is a very important piece.
@TheOnewiseburdman7 жыл бұрын
I know this is old- but thanks so much. I spent way too much time trying to get this to work.
@ScottBatson7 жыл бұрын
Glad to hear it helped!
@supermac91834 жыл бұрын
This tutorial is really awesome.
@MrSandeepjoel5 жыл бұрын
Awesome step by step tutorial scott!! Really cool!!
@jahidhasanjibon3982 Жыл бұрын
you are awesome..super duper tutorial.
@syamphanindra73146 жыл бұрын
Super Tutorials Keep going..
@marcus46198 жыл бұрын
This was a fantastic tutorial. I have been trying to get this to work forever now. I have set up a nodejs/express/mongodb database api and need to try to connect my emberjs app to it on the same server. How is this done?
@ScottBatson8 жыл бұрын
Where is your API being served? Is it locally and on a specific port? On my current project, the API is running at `localhost:4000/api/v1` so I have to run my ember app through a proxy to hit it: 'ember s --proxy localhost:4000' Then in my application adapter, I just declare the namespace as 'api/v1'
@marcus46198 жыл бұрын
ah this works great. I am still new to web development and I ask a lot questions. But thank you this is what I needed. I also have a question about using build setting environment to production and storing files in a folder on the node side and serving up the files from node
@tombarfoot7148 жыл бұрын
Thank you for the great video! I'm new to ember, and I'm trying to connect to my existing REST Api's, this tutorial got things goin g for me. When calling own API's, ember seems to render the template before all the data has been returned, I'm only seeing 2 of 50 records. I can see all the data is returned in the debugger, but not in the app. Any comments or pointers would be very helpful. Thanks again!
@ScottBatson8 жыл бұрын
Thanks for watching! Are you returning just one model? i.e. are you just making a request to "posts" and expecting 50 results? If you are returning multiple models, you may want to look into using RSVP.hash emberjs.com/api/classes/RSVP.html#method_hash You could also just wrap what is returned in your model hook in a promise (the model hook should wait for the request to be handled and it receives a response, but it sounds like you have an odd race condition). Happy to look if you have an example twiddle.
@tombarfoot7148 жыл бұрын
I put my code on Pastebin here pastebin.com/wuM9qAZn I did get your example here working perfectly using jsonplaceholder.typicode.com. I then tried my own API, and ran into some kind of timing issue. My back-end code is done with PHP and it does a simple query on a MySQL table that returns JSON encoded data. (works fine with Postman, my mobile apps etc.) I'm doing this.store.findAll('logs') in my ember code, and I'm just not understanding the issue with the returned data and why I can't loop over ALL of it, and print it out as in your tutorial. Thanks again for your tut & help.
@tombarfoot7148 жыл бұрын
Just a final FYI, after some research, this article explains what is happening: github.com/emberjs/data/issues/3657. I'm running ember-data 2.8.x and it has the same issues noted in the discussion, still not fixed.
@cacanantes8 жыл бұрын
Thank you. The best videos about ember for new ember devs. I'm just wondering if wouldn't be better to use DS.JSONSerializer (not JSONAPISerializer) instead of RESTSearializer. It seems to me that it would avoid the need to override normalizeResponse function for any kind of json. Could you say something about it?
@ScottBatson8 жыл бұрын
Thanks for watching. Great question! Yes, JSONserializer definitely makes more sense in this instance as a RESTserializer expects data to come through in a nested resource. I was attempting to go through an issue I first ran into when starting with Ember, where the option of additional serializers wasn't obvious (since it creates a RESTserializer by default). Ultimately, I think it is good to just know that you can play with these normalizeResponses. Most API's with this format are pretty old. Hopefully, people only have true RESTful API's or true JSONAPI to deal with.
@almost51987 жыл бұрын
subbed! keep the videos coming bro, u're the best!!!!!!!!!!
@sheriffderek53337 жыл бұрын
Great video. I was building a small example with typicode and I thought I'd watch a video while I did that. AND the video was basically exactly what I was doing! Perfect. haha. I was not really sure what pathForType() was for though. What's the story on that?
@ScottBatson7 жыл бұрын
Thanks for watching! pathForType() is the pathname from your API's host. For example: foo-bar.com/post. "foo-bar.com" is the host and "post" is the pathname. By default, Ember-data makes the "pathForType" return the pluralized version of the model name. In this video, we shouldn't need to add our own "pathForType" method, but I thought it would be good to know it is there. Sometimes you may have an API where the path doesn't match your model name (i.e. it may be "blog_posts" or something) and you need to specify to your app how to hit that API. emberjs.com/api/data/classes/DS.RESTAdapter.html#method_pathForType
@sheriffderek53337 жыл бұрын
Excellent. Thanks!
@myfishingstats15297 жыл бұрын
Hey Scott, thanks for the great tutorial! In your previous video you showed how to use pod structure. So if you were using pod structure, would you suggest putting the adapters and serializers in the post and user folders?
@ScottBatson7 жыл бұрын
I personally still liked having the adapters and serializers in the "adapters" and "serializers" directories because multiple routes/models could use them. Over the past few months, however, it looks like the ember core team is moving away from pod structure. It's still supported but it will no longer be the recommended way of building apps in Ember. I kind of liked it but it may be best to get used to not using it :(
@pragatidugar6 жыл бұрын
Hey , Ember learners will receive a great help if can you please make a tutorial on differences between unit,integration and acceptance tests in ember . And walk through examples. Thanks.
@lydiarodrigues42617 жыл бұрын
Thanks a lot, amazing tutorial !!
@ScottBatson7 жыл бұрын
Thanks for watching!
@viksk42586 жыл бұрын
awesome Scott...
@sivasubramanianramanathan69454 жыл бұрын
Great Stuff
@TTVbygowtham3 жыл бұрын
very useful video
@joseurielsalazarzuniga76746 жыл бұрын
Thank you for the video!
@a895292946 жыл бұрын
Hi, I tried commenting out pathForType functions in the adapters and it still works, although I'm using Ember v3.0
@ScottBatson6 жыл бұрын
Thanks for watching! Hmm, that seems odd. As far as I know `pathForType` hasn't been deprecated: guides.emberjs.com/v3.0.0/models/customizing-adapters/#toc_path-customization
@a895292946 жыл бұрын
Thanks for the reply! I think it's because if this: guides.emberjs.com/v3.0.0/models/customizing-adapters/#toc_url-conventions So I didn't have to specify the path, it is already the default.
@indramomo90176 жыл бұрын
Thanks Scott
@paulhowell2 жыл бұрын
I'm actually attempting an ember version 1 to version 2 upgrade, and having to do exactly what you've shown in your video. Let's say you don't handle the action in the controller from a component, should it finally bubble up to the ApplicationRoute, then I can handle it there? This is what I'm currently having trouble with, it's like a global logout action we've got.
@paulhowell2 жыл бұрын
Sorry I commented on the wrong video, should have been the components one. But I think I'm meant to pass in the actions to the component as an attribute, then in the actual component have another action, then will call the other action I passed in.
@mfich7 жыл бұрын
Great video, Scott! Do you still need to use this._super( ... ) with all of the arguments specified explicitly rather than using this._super(...arguments) instead? The only reason I ask is because it looks like that may not be the case based on these docs: guides.emberjs.com/v2.11.0/models/customizing-serializers/#toc_customizing-serializers
@ScottBatson7 жыл бұрын
Thanks for watching! That's interesting--it wasn't the behavior I noticed when preparing this video but I'd trust the official guides ;)
@muhiuddinshahani3495 жыл бұрын
nice one on Ember i follow all the steps of video and working perfectly . But having issue when i access my own local server the records are not coming from server how can i know does my Ember application is connected to the local server or not ?
@ScottBatson5 жыл бұрын
Thanks for watching! Is the host in your adapter pointing to localhost? How are you running the local server? It shouldn't be much different, but there may be issues with CORS you'd have to resolve if it is hosted under a different port
@EmadAlblueshi8 жыл бұрын
Thank you
@SergueiCambour6 жыл бұрын
What is most difficult to understand is the relation defined between Post and User was userId: belongsTo('user') instead of user: belongsTo('user') and when you called in your template: post.userId.name you got a User name. Why so ? API sent userId as an Integer value, by which magic trick Ember guessed that when calling post.userId.name it should return a name of a User ? Really still weird for me ... How Ember knows that it should hit a User resource when having just the userId value in the JSON sent for /posts request ?
@joaocardoso54757 жыл бұрын
Thanks a lot!
@ivandong8 жыл бұрын
Why you didn't create an "application" adapter to handle the host instead of creating one and importing it to each adapter?
@ScottBatson8 жыл бұрын
You could absolutely do that, but then you are making the assumption that all AJAX/Ember Data requests will be hitting that API. There may be instances where you are working with multiple API's in your app (I've worked on apps that had an API for user data, an API for our Blog from WP and one for public financial information) and you may therefore have 3 types of adapters that you want to extend from. But if there's 1 API, then yes, the application adapter is definitely the right way to go! I just wanted to cover something less obvious.
@ivandong8 жыл бұрын
I see. Sounds very reasonable. I am learning more about Ember-data and have seen the "application" practice, i guess because it might be more practical for demonstration purposes. The scenario you mention sounds like a more real life enterprise case. Thanks for the answer. This is a very nice video.
@almost51987 жыл бұрын
btw when using the dynamic route why did you specify userId return this.store.query('post',{ userId: params.id }) i used to do this before but it doesnt work here return this.store.query('post',params.id) Is it becoz of the relationships in the models?
@ScottBatson7 жыл бұрын
Thanks for watching! Good question. I specified "userId" as I wanted to list all the posts for a specific user. You can try the query yourself by directly typing it into the URL: jsonplaceholder.typicode.com/posts?userId=2 . You will see only posts from a user with an id of 2. this.store.query('post', params.id) won't quite work. store.query expects 2 params. The first is the name of the model and the second is a hash with key value pairs. If you want to get a specific record by an id, you would want to use "findRecord" return this.store.findRecord('posts', params.id)
@almost51987 жыл бұрын
o thanks,i got confused between findRecord and query, my bad.
@MrTheDanils7 жыл бұрын
Hi Scott! Say me please, how i can to make adapter for all types like 'jobs, messages etc.'? Without requestForType.
@ScottBatson7 жыл бұрын
I'm not sure I follow the question. Could you elaborate?
@pragatidugar6 жыл бұрын
Hey.. so whats the other option of getting data in our route ,if I want to hardcode data and not get from jsonplaceholder.typicode.com ??
@almost51987 жыл бұрын
HOpe you do a tut on ember simple auth
@sanitthale31857 жыл бұрын
Hi Scott, Awesome Video.. I was able to follow your video and able to work with external API but currently I'm facing issue with different external API which related to 'Origin policy' i.e. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'localhost:4200' is therefore not allowed access. I tried many things but no luck I'm hoping you can help to configure this external API. Thanks In Advance.
@ScottBatson7 жыл бұрын
You can set content-security flags in your environment.js, but this may actually be your browser blocking the request. You can utilize ember-cli-content-security-policy to get around it (hopefully): github.com/rwjblue/ember-cli-content-security-policy
@vivekraj_kr7 жыл бұрын
Nice tutorial.. do you have its source code...?
@ScottBatson7 жыл бұрын
No, sorry. This was on my old computer and I never pushed it up anywhere :(
@vivekraj_kr7 жыл бұрын
Scott Batson if it's possible pls push it on GitHub.
@AshishKumar-fw5jg4 жыл бұрын
I was using Country rest api "restcountries.eu/rest/v2/all". I have got issue at some place , couldn't way to find out. i serialized the data and console it , it shows . But at UI it doesn't . shows error "Assertion Failed: normalizeResponse must return a valid JSON API document: * Top level of a JSON API document must be an object"
@AshishKumar-fw5jg4 жыл бұрын
thanks ... i got solution
@4funszejk4423 жыл бұрын
@@AshishKumar-fw5jg tell me how you solved it, i also have such a problem
@saranguru61005 жыл бұрын
`Error while processing route: posts Assertion Failed: Unable to find transform for 'body' EmberError@localhost:4200/assets/vendor.js:13869:31` getting this error after adding the arguments in this._super() method.Response is coming for my app.but its not dispalying in the page.Kindly help me out.
@mohamadelmousawi25197 жыл бұрын
Great explanation, i don't know for what reason, but i got this (localhost:4200/posts/77) working without making any changes to normalizeResponse(...). Thank you!
@ScottBatson7 жыл бұрын
Thanks for watching! I believe there have been some updates to Ember Data since this video was made that makes serializers better at working with different payload types. But still good to know you can go in there and make changes if you have to!
@gu1231231237 жыл бұрын
Does anybody know where the code from this video can be downloaded from?
@ScottBatson7 жыл бұрын
Unfortunately, I never pushed this up to GitHub and I no longer have the computer this was recorded on. So, I think the code for this is gone forever :(
@pragatidugar6 жыл бұрын
can you please share github repo?
@ScottBatson6 жыл бұрын
Unfortunately, I didn't think to save this repo when I created it and it has since been lost :(
@jaxgarry78812 жыл бұрын
this error in later versions "findAll is not a function" , is a real roadblock. if anyone has a way around this, please let me know. maddening. thanks
@ScottBatson2 жыл бұрын
Sorry to hear that. Unfortunately, I haven’t worked in Ember for a few years. If they deprecated it though, it should be documented somewhere what the alternative is
@mateolincango98432 жыл бұрын
Pls let me know if u find a solution I have the same problem and i was looking for it on internet but i couldn-t find a solution
@pragatidugar6 жыл бұрын
hey ..this is great tutorial, but in localhost:4200/posts, I am getting following error: Error while processing route: posts Assertion Failed: normalizeResponse must return a valid JSON API document: * Top level of a JSON API document must be an object Error: Assertion Failed: normalizeResponse must return a valid JSON API document: * Top level of a JSON API document must be an object
@ScottBatson6 жыл бұрын
Hi Pragati. When this video was created, the default serializer that was generated was a RESTSerializer. That has since changed and now they default to JSONAPISerializer. JSON API has a strict format you need to follow. Since the API used in this video doesn't follow that format, you'll want to change your serializer to RESTSerializer. You can read more on the JSON API spec here: jsonapi.org/
@pragatidugar6 жыл бұрын
hey Scott,thank for quick reply..but i did changed my serializer to rest.what else?
@ScottBatson6 жыл бұрын
That should have been all you had to do. Are you still getting an error with normalizeResponse?
@pragatidugar6 жыл бұрын
Scott Batson yes
@ScottBatson6 жыл бұрын
hmm. It's hard to diagnose without seeing the code. Do you have a repo?