spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » EMBER JS » Page 1
http-mock naming conventions
Ok well the answer turns out to be ... turn off "ember serve" and restart. Not sure why it wasn't refreshing but apparently the mocking does not always (ever?) gracefully refresh when updated. In any event, my expectation about "naming convention" appears to be the naming convention so I can happily report that all is right in the world again.

Categories : Ember Js

How to prevent double clicks with ember.js?
As a one-off, if you bind the disabled attribute on your button like so <button {{action go}} {{bind-attr disabled=actionPerformed}}> and then set up your controller like var FooController = Ember.ObjectController.extend({ actionPerformed: false, actions: { go: function() { this.set("actionPerformed", true); console.log("done!"); } } }); then the b

Categories : Ember Js

Update View/Model after "reset" in ember
You can use this hacky approach: @get('model').destroyRecord().then(=> @store.find('systemStyle').then( (obj) => @set 'model', obj ) ) Edit: Fix by Nicolas.

Categories : Ember Js

How to limit number of records returned using this.store.find in a route
That's ok. I re-read an Ember.js tutorial and realised limit is just a parameter for my API; so I set it in my Rails API controller and got it working. def index if params[:limit].present? @articles = Article.limit(params[:limit]) else @articles = Article.all end render json: @articles end You can also further limit the stored records using slice in Ember.js: ca

Categories : Ember Js

Trying to use jsonp with ember-data, and unable to use Ember App's store.createRecord in custom adapter
This parsing of the response seems more like a job for the RESTSerializer than the RESTAdapter(though you will still need the adapter if you need to set the dataType/url) Not 100% sure, but it looks like your reponse is an array that doesn't have the correct key as stated in the jsonapi.org documenation? If this is the case, you'd want to create a serializer for events like this App.EventsSeria

Categories : Ember Js

Ember CLI - Shared Resource Addon
Maybe the better solution would be to use Git Submodules instead of Shared Addon. This also works for any other shared code. In this case you would have three repositories: 1) First app, 2) second app, 3) shared code. And you can link the third one to any other repositories as a submodule (think of it as a symlink). For example, you can link your submodule to /public/shared folder and then use

Categories : Ember Js

Component test Ember-CLI with {{link-to}} helpers
I believe this is because when you are using the moduleForComponent helper you do not have your Ember App booted. The link-to helper requires the router, which wouldn't exist or be properly setup unless the app had actually booted (i.e. using the regular module helper and calling startApp() in the beforeEach block). I am not sure of the best solution here... you could do a normal integration tes

Categories : Ember Js

Livereload with Ember-CLI; only reload changed assets
I believe this is still a work in progress with Ember CLI and is planned for a future release, or is depending on a fix in Broccoli. See https://github.com/stefanpenner/ember-cli/issues/2371 What I've done to get around this probably isn't ideal, but I end up using grunt, and use a shell command to run ember build, copy the output to a different directory that is being served by another server (i

Categories : Ember Js

How to write a failing test with ember to show pushObject is required (instead of just push)?
Are you looking for a way to show that pushObject() works with observers, but modifying the array in other (non-Ember friendly) ways doesn't work? If so, I think this JSBin shows that. It seems as if a simple array bound to a Handlebars template is enough to show that push() doesn't work, but pushObject() does.

Categories : Ember Js

Execute action on link-to
You should do teardown operations such as closing modal boxes within the willDestroyElement event of your current view. By doing this, you could just {{link-to 'register'}} and let your view (template-view.js) manage the fact that there is a modal to close or not. Checkout the docs of willDestroyElement HERE

Categories : Ember Js

Emberjs: Accessing dynamic segment in nested routes/controllers
I think you're looking for route#modelFor. Example: App.Router.map(function() { this.resource('post', { path: '/post/:post_id' }, function() { this.resource('comments'); }); }); App.CommentsRoute = Ember.Route.extend({ afterModel: function() { this.set('post', this.modelFor('post')); } });

Categories : Ember Js

Ember - data is nested n levels deep, want findBy in route to work from URL
Unfortunately, there isn't a recursive version of findBy. The "standard" way to handle something like this is to store your objects in a flat data structure: either a hash with object IDs as keys, or an array of objects. Your tree of tags is a somewhat arbitrary/unique data structure, so you have two options: Represent your data in a more standard way, thereby allowing you to use the standard

Categories : Ember Js

Using Ember Data RestSerializer to POST to a 3rd-party API, how can I change the payload format?
When you're dealing with questions of [your store] -> [persistence layer], you usually are talking about the Adapter (not the Serializer). I think adapter#createRecord is what you want to override.

Categories : Ember Js

Ember-data keeps saying "no mdel was found for"
I'm not 100% sure, but the problem might be in wrong formatted fixtures for App.Person. Could you rewrite fixtures like this? app.Person.FIXTURES = [ { id: 1, first: "first_1" }, { id: 2, first: "first_2" } ]

Categories : Ember Js

Using a helper as component attribute
Don't think you can do that. I'd say either make a new property on whatever context that nav-title is being rendered in and do the logic there, or make a new component and move the logic inside. It's ok to use components for domain-specific stuff. For example this could be a user-likes-nav component, which knows how to translate a user's likes before rendering the template.

Categories : Ember Js

Serving Static Pages ember.js
I know this isn't the best way of doing it but it fit my needs. I ended up just displaying the static page in an iframe at the bottom of the product page. Whenever you click view more, I hide the page with jQuery then show the iframe which gets the html loaded in through the anchor tag. Then I added a 'view less button' that hides the iframe and shows the page again. HTML <script type="text/

Categories : Ember Js

Ember.js Modal Dialog renders invisibly
Did you get the relevant CSS from the JSBin example? If the HTML is rendering but you can't see it, it may be because you haven't styled the modal window: .overlay { height: 100%; width: 100%; position: fixed; top: 0; left: 0; background-color: rgba(0, 0, 0, 0.2); } .modal { position: relative; margin: 10px auto; width: 300px; background-color: #fff; padding: 1em; }

Categories : Ember Js

Specify content when rendering with helpers
You could use with: {{#with someObject}} {{partial 'some-partial'}} {{/with}} However, you really shouldn't do this. Whatever you're using render for should probably be a component. Then you'd just pass the type into it, and work with the local variable in your component's template.

Categories : Ember Js

Ember doesn't update (change) id of related model
Ember doesn't allow you change IDs of models that have relationships via simple ajax request. I ended up modifying my serializer: App.RoomSerializer = DS.ActiveModelSerializer.extend serialize: (record, options) -> json = @_super(record, options) json.floor_id = record.get('floorId') json

Categories : Ember Js

Ember can't find template when I provide a custom templateName to a View in Ember-CLI
In the Ember-CLI world, you want to use the ES6 import syntax, and supply your template to the View's template property: // app/views/my-view.js import Ember from 'ember'; import Template from 'app/templates/my-template'; export default Ember.View.extend({ template: Template });

Categories : Ember Js

Recieving 403 Forbidden on PUT Request EmberJS
You are PUTting a file and the authentication is wrong so the request is rejected. Check your authentication; also see http://www.embercasts.com/ for some tutorials on EmberJS authentication.

Categories : Ember Js

Emberjs: Accessing parent route model which is a Promise (master-detail)
I see a few things here. when defining routes that have the same url as the route name theres no need to specify the path the detail route should also be a resource as it is a route backed by a model In the Masters route returning a promise is correct and supported natively by ember. The route wont be resolved until the promise is. setup controller isn't required its usually best to do the req

Categories : Ember Js

Downloading files with Ember app
Why don't you just return the URL path for the download in your model for "/model/1". Then you can easily create links in your handlebars templates like so: <a href="{{model.download}}" target="_blank">Download File</a>

Categories : Ember Js

Ember and immediately-invoked functions
This is typically done to isolate modules from one another, since JavaScript variables are scoped at the function level. If your team is able, you should switch the app over to Ember CLI, which takes care of this kind of stuff for you (plus, a whole lot more).

Categories : Ember Js

Emberjs Routing: Page reloads on every link click
When you say a "proper link" do you mean an <a href> tag? If so, you should be using the {{link-to}} helper instead. See http://emberjs.com/guides/templates/links/

Categories : Ember Js

Mocking models for testing Ember.easyForms input component inside another ember component
The problem seems to be that you are using content. in your paths optionLabelPath="content.siteLabel" which is thinking about controller proxing to a model. But your test are using the models directly -undecorated by a controller- and they do not have a content property.

Categories : Ember Js

Hiding parent view in Master/Detail pattern
I would be tempted to use the exercises/index template to display the list of exercises. That way it’ll be automatically swapped out when you transition into exercises/exercise. You could then use liquid-fire to add a graceful transition. However, that solution won’t allow you to keep the full list of exercises on-screen for desktop browsers. For that case, I’d say the right approach would

Categories : Ember Js

How to sort many to many through a join model data with Ember.js and Ember Data
While I would have expected your sortBy call to work as well, I've replaced it instead with a more succinct computed property, which seems to do the trick: App.ModuleController = Ember.ObjectController.extend({ uname: function() { return this.get('name').toUpperCase(); }.property('name'), moduleCoursesSorting: ['course.name'], sortedModulesCourses: Em.computed.sort('modulesCourses',

Categories : Ember Js

Ember Data Push vs Update
The purpose of push is to load complete records into the store, while update is meant to push partial records. So push is useful if you want to completely replace a record, possibly removing attributes. So let's say you have the following record in your store: { "id": 1, "name": "Bob", "status": "Going to the movies today!" } Now you also have the following JSON you want to load int

Categories : Ember Js

prototype extensions with ember-cli
You have a few options. Add a file to the vendor/ directory with your extensions and include it in your Brocfile.js like so: app.import('vendor/my-prototype-extensions.js'); Do it in an initializer. ember g initializer extensions Then in app/initializers/extension.js add your extensions like so export var initialize = function() { Array.prototype.move = function (old_index, new_index) {

Categories : Ember Js

Use bind-attr helper with input helper in emberjs
Refer to Views: Customizing a View's Element for general view customisation. You can use classNameBindings in much of the same sort as you are using in bind-attr above. In view: export default Ember.TextField.extend({ classNameBindings: ['showmsg:alert-msg'], showmsg: true }); If you want to do something such as dynamic classes, you can pass values to your view through, for example,

Categories : Ember Js

Ember component not rendering string from API call
The short answer is yes A longer answer, you have a couple options you can use Ember.RSVP promises to either return a promise, or, after the promise has been fulfilled, return the result robert ward has a good screencast on how to do this in more detail. definitely worth a look if you're just starting out, as his information is applicable(ember-cli is a set of build tools built around ember) y

Categories : Ember Js


Recently Add
Has Many relationship undefined in computed relationship Cannot read property 'reject' of undefined
http-mock naming conventions
How to prevent double clicks with ember.js?
Update View/Model after "reset" in ember
How to limit number of records returned using this.store.find in a route
Trying to use jsonp with ember-data, and unable to use Ember App's store.createRecord in custom adapter
Ember CLI - Shared Resource Addon
Component test Ember-CLI with {{link-to}} helpers
Livereload with Ember-CLI; only reload changed assets
How to write a failing test with ember to show pushObject is required (instead of just push)?
Execute action on link-to
Emberjs: Accessing dynamic segment in nested routes/controllers
Ember - data is nested n levels deep, want findBy in route to work from URL
Using Ember Data RestSerializer to POST to a 3rd-party API, how can I change the payload format?
Ember-data keeps saying "no mdel was found for"
Using a helper as component attribute
Serving Static Pages ember.js
Ember.js Modal Dialog renders invisibly
Specify content when rendering with helpers
Ember doesn't update (change) id of related model
Ember can't find template when I provide a custom templateName to a View in Ember-CLI
Recieving 403 Forbidden on PUT Request EmberJS
Emberjs: Accessing parent route model which is a Promise (master-detail)
Downloading files with Ember app
Ember and immediately-invoked functions
Emberjs Routing: Page reloads on every link click
Mocking models for testing Ember.easyForms input component inside another ember component
Hiding parent view in Master/Detail pattern
How to sort many to many through a join model data with Ember.js and Ember Data
Ember Data Push vs Update
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.