ember

Views vs Components in Ember.js

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am learning ember.js, and I am trying to understand the difference between a view and a component. I see both as a way of making reusable components. From Ember's website on views: Views in Ember.js are typically only created for the following reasons: -When you need sophisticated handling of user events -When you want to create a re-usable component From Ember's website on components: A component is a custom HTML tag whose behavior you implement using JavaScript and whose appearance you describe using Handlebars templates. They allow you

Why isn't my ember.js route model being called?

匿名 (未验证) 提交于 2019-12-03 01:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I just started learning Ember.js (bought the PeepCode screencast), and am learning quite smoothly from it, but ran into a problem when trying to write my first Ember app. Here's the (nested) route mapping: App.Router.map(function () { this.resource('bases', { path: '/' }, function () { this.resource('base', { path: ':base_id' }, function () { this.resource('places', function () { this.resource('place', { path: ':place_id' }); }); }); }); }); This allows urls like this: domain.com/#/yokota-ab-japan/places/4c806eabd92ea093ea2e3872 yokota-ab

Assigning 'active' class to selected list item in EmberJS

匿名 (未验证) 提交于 2019-12-03 01:55:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a list and I'd like to set one item as class="active" automatically. Given the following bootstrap code: {{#linkTo "index"}}Index{{/linkTo}} {{#linkTo "about"}}About{{/linkTo}} {{#linkTo "login"}}Login{{/linkTo}} atIndex, atAbout and atLogin reside in my ApplicationController. To render as: Index{{/linkTo}} About Login What's the best way to do this with Ember 1.0 pre4? I'd rather not add special code to every view or controller. PS - atIndex: true works, but atIndex: function() {return true; }.property().volatile() does not. Which

How to enable CORS in an EmberJS application?

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an EmberJS application that uses ember-data to access data via a REST API. The REST API is running on the same machine but on a different port (although this probably applies to REST API's that are served from another domain. When I go to the URL localhost:4200/items I get the following error in the Firefox console: Content Security Policy: The page's settings blocked the loading of a resource at http://localhost:7654/api/items ("connect-src http://localhost:4200 ws://localhost:35729 ws://0.0.0.0:35729 http://0.0.0.0:4200 "). I tried

Ember Engine Uncaught Error: Could not find module ember-views/views/select

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Created new app with ember new app-name version: 1.13.13 node: 5.5.0 npm: 2.14.10 os: linux x64 After running "ember s" App works proper in browser As per guide at https://github.com/dgeb/ember-engines for running ember engine ran below command ember install ember-engines rm -rf bower_components bower install --save ember#canary #Choosed ember#canary from prompt bower install And now when i do "ember s" app gets compile properly in CLI but app gets crash in browser and i see nothing in browser. In console i see below error message Uncaught

EmberJS: Good separation of concerns for Models, Stores, Controllers, Views in a rather complex application?

匿名 (未验证) 提交于 2019-12-03 01:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm doing a fairly complex emberjs application, and tying it to a backend of APIs. The API calls are not usually tied to any particular model, but may return objects of various types in different sections of the response, e.g. a call to Events API would return events, but also return media assets and individuals involved in those events. I've just started with the project, and I'd like to get some expert guidance on how best to separate concerns to have a clean maintainable code base. The way I am approaching this is: Models : essentially

Ember Data - rollback if navigating away from a form

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: My application has new / edit forms for a set of entities read from a backend. When I open such a form, and fill out / edit some fields, then navigate away, the records appear changed in the entity lists, even though I did not commit those changes. Reloading the app (which reloads the data from the backend) fixes the issue, but is not an option. I've tried doing some transaction rollbacks in the form view's willDestroyElement, but this seems fundamentally wrong since it gets called even after successful form submits (and actually

{{content-for 'head'}} Ember-cli

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been using Yeoman ember generator for the past 1 month and now, I'd like to give ember-cli a try. I run the generator and launch the app, everything works fine. ember new my-new-app ember server but I'd like to know how does {{content-for 'head'}} in app/index.html works? When looking at other examples from http://www.ember-cli.com/#tutorials , none of them are using this particular helper? Is it because they are using older version of ember-cli? Why weren't they using this content-for helper? I'm pretty sure that ember.js doesn't have

Accessing Index in #each in emberjs

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Hello everyone please check out the code attached http://jsbin.com/atuBaXE/2/ I am trying to access the index using {{@index}} but not seems to be compiling. I think handlebars supports that {{#each item in model}} {{@index}} {{item}} {{/each}} It is not working out for, I can't figure out if the {{@index}} is supported or not I am using Ember.VERSION : 1.0.0 Handlebars.VERSION : 1.0.0 Thanks 回答1: UPDATE Since this PR , it's now possible to use the each helper with index, taking advance of the new block params syntax. This is available on

Ember-data “Cannot call method 'hasOwnProperty' of undefined”

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have the following Ember.js model: Filters.Milestone = DS.Model.extend({ id: DS.attr('string'), name: DS.attr('string') }); In my app.js I have the following settings for the model (loaded prior to the model): Filters.MilestoneSerializer = DS.RESTSerializer.extend(); Filters.MilestoneAdapter = DS.RESTAdapter.extend({ namespace: "ember" }); When loading the page, an AJAX call to the milestones list is done. The following JSON is returned: { "milestones": [ { "id": "1", "name": "Test Milestone #1" } ] } When the JSON is loaded, the following