super-rentals | Codebase for the Super Rentals official tutorial | Frontend Framework library
kandi X-RAY | super-rentals Summary
kandi X-RAY | super-rentals Summary
This is a working repository for the Super Rentals tutorial, which you can check out at
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of super-rentals
super-rentals Key Features
super-rentals Examples and Code Snippets
Community Discussions
Trending Discussions on super-rentals
QUESTION
I am quite new to ember.js. I have been working on the tutorial and having issue with generating adapter application.
When i run the command ember generate adapter application i can see message saying installing adapter and installing adapter-test but no file is getting generated in the folder structure .
Package.json
...ANSWER
Answered 2019-Jul-23 at 07:48Ola @Divakar, thanks for your question! And Welcome to Ember
Looking at your question it seems like it could be related to an issue that we had recently in ember-data where the generators were broken. I think they were fixed in ember-data@3.11.1
but from your package.json it would seem that you have ember-data@3.11.0
If you want to update ember-data and see if the issue is still there you can run the following:
QUESTION
I'm following this Ember tutorial and I've suddenly run into an issue where my rental-listing.hbs
template component stops rendering. It started when I began implementing the map service.
I don't understand where this could be happening. I've copied the code from parts of the GitHub repository that I thought were relevant but to no avail.
I have a rental.hbs
template that looks like so:
ANSWER
Answered 2019-Jun-18 at 13:59Are you able to provide a link to your example? By having each piece of the ember application you mention it would be best to answer definitely. I can give a general answer with strategies for debugging the template.
The conventions behind ember.js make understanding the "whys" frustrating at first and possibly opaque. Ember's handlebars implementation governs how values are populated and accessed within templates using very specific rules. Ember treats templates (handlebars files) differently depending on whether it is for a route or component. Component's have an isolated context and must receive values by explicit passing in or dependency injection. Then, you can use such values in a component's template by accessing those properties with {{this.somePassedInValue}}
.
In the super-rentals
app, it appears the rental index route invokes the components responsible for displaying the individual units. I found this in app/templates/rentals/index.hbs
.
QUESTION
I am following this tutorial: https://guides.emberjs.com/v2.8.0/tutorial/installing-addons/
and when i get to adding ember-cli-mirage it comes up with a build error and wont load the app:
...ANSWER
Answered 2018-Mar-17 at 19:34Is there a specific reason you are starting with Ember 2.8? Unless there is, I would suggest fully removing Ember-CLI (npm uninstall -g ember-cli
) and starting over with Ember 3.0.
The reason I suggest that is that the errors you are seeing there look to be due to Babel upgrades that Mirage is expecting in the latest version of Mirage but that don’t exist in the older version of Ember that you have installed.
QUESTION
How can I get this helper to return the result of a promise?
...ANSWER
Answered 2017-May-25 at 17:37I would say, returning Promise instead of helper you can try computed property. You can create computed property which depends on location
. Refer this sample twiddle
QUESTION
This Ember template code...
...ANSWER
Answered 2017-May-23 at 19:47The problem is that; city-temperature
is a component; and by default ember components is assigned div
as their tags. Due to this; the content of city-temperature
starts at a new line.
What can you do? Play with css
and make sure div
tag of city-temperature
does not start at a new line; but instead floating right within the owner div. The second option is making city-temperature
component tagless; so that it does not start at a new line. To achieve that; you can just declare:
QUESTION
I want to add "Weather: 24C" to the rental-listing
component of the super-rentals
tutorial app.
Where would be the "best-practices" place to put this ajax request?
...ANSWER
Answered 2017-May-19 at 13:30You need to configure mirage to allow you making calls to outside in case mirage is active; what I mean is using this.passthrough
function within mirage/config.js
, that is explained in api documentation quite well.
Regarding your question about where to make the remote call is; it depends:
- If you need the data from the server to arrive in case a route is about to open; you should prefer putting it within
model
hook of the correspondingroute
. - If you intend to develop a component that is to be reused from within different routes or even from within different applications with the same remote call over and over again; you can consider putting the ajax remote call to a component. Even if that is not a very common case usually; it might be the case that a component itself should be wrapped up to fetch the data and display it by itself for reusing in different places; there is nothing that prevents you to do so. However by usually applying data-down action-up principle; generally the remote calls fall into routes or controllers.
- Whether using an
ember-data
model
is another thing to consider. If you intend to useember-data
; you should not directly useEmber.$.ajax
but rather be usingstore
provided byember-data
and perhaps providing your custom adapter/serializer to convert data to the formatember-data
accepts in case the server do not match to the formats thatember-data
accepts. In summary; you do not need to usemodel
s if you use pure ajax as you do in this question.
QUESTION
EDIT: Upon looking further, something is calling toString
on the array being returned from the model hook. Hard-coded, this method works fine, but being returned like I have below, it doesn't.
TL;DR: I'm manipulating one array of data to a different "format" so that I can use the Ember Charts add on. To do this, I'm using Ember.RSVP in the model hook of my route, but I'm getting a TypeError: Cannot convert object to primitive value
and don't know why.
I've been learning Ember (followed their quickstart and then super-rentals tutorial), and I am now trying to build my own project with it.
The issue that I'm having is dealing with async operations within the model hook of my route. This may be a long read, but I'm trying to be very specific. The end problem, however, is that I'm getting a TypeError: Cannot convert object to primitive value
at the end of it all.
I'm using Mirage to fake a backend API, and it returns my data like this:
...ANSWER
Answered 2017-May-04 at 17:24EDIT: the answer still lies with JSON.parse(JSON.stringify(data))
, but I updated with kumkanillam's much simpler approach returning the data.
It turned out the error was coming from Array.toString
being called on the data being returned from the model hook. It worked fine on a hard-coded array of objects, but not when returned via RSVP as I have in my question.
Upon inspecting both, it turned out, when using Ember.RSVP, the objects in the returned array lacked a toString method on them, somehow... I tried solving this via setting the prototype with Object.create(), but didn't work.
Bottom line is, and I'm still not 100% clear, I thought maybe Ember was turning my array into something else (an Ember Object?), not just a plain JS array of objects. So I ended up converting the returned data into a plain JS object again, via this answer.
Route now looks like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install super-rentals
cd super-rentals
yarn install
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page