ember.js

Self nested infinite routes in Ember.js

我的未来我决定 提交于 2019-12-23 17:01:09
问题 I would like to make a sort of directory structure with Ember.js. Here is an example of how an url can look like: folder/1/folder/44/document/3 As you can see a folder can have multiple folders inside but also documents. I'm wondering how I should handle something like this in my router because beforehand my application doesn't know if a folder has other folders inside or only documents. I think I need to make separated routes instead of nested routes: App.Router.map(function() { this.route(

Inserting a translation into a placeholder with Emblem.js

江枫思渺然 提交于 2019-12-23 16:56:07
问题 I'm trying to write a login form with ember.js/emblem.js. Everything works, unless I try I18ning the placeholders like so: Em.TextField valueBinding="view.username" placeholder="#{t 'users.attributes.username}" Em.TextField valueBinding="view.password" placeholder="#{t 'users.attributes.password'}" type="password" I get the same response if I try: = input value=view.username placeholder="#{t 'users.attributes.username}" = input value=view.password placeholder="#{t 'users.attributes.password'}

Can't find module on migrating ember-cli app to TypeScript

爷,独闯天下 提交于 2019-12-23 16:35:48
问题 I want to try ts inside my ember project ( I try it before on small applications ) So i have "ember-cli-typify": "^0.3.1", "typescript": "^2.0.3" "typings": "^1.4.0" "ember-cli": "2.4.3" Inside my tsconfig.json { "compilerOptions": { "target": "ES6", "allowJs": true, "moduleResolution": "node", "noEmitOnError": true, "noEmit": true, "baseUrl": ".", "paths": { "ember": ["node_modules/at-types-ember"], "npm:*": ["local-types/*"], "*": ["local-types/*"] } }, "include": [ "app/**/*" ], "files": [

Ember data model reload causes item in {{each}} to be removed/inserted back - losing current state

放肆的年华 提交于 2019-12-23 16:34:37
问题 How could I prevent the itemView from being removed and re-rendered back in place when iterating over a controller's arrangedContent , if the observed model's property doesn't change value? Short version below, using a blog post App.Post as example model: Controller: sortProperties: ['createdAt'] Template: {{each arrangedContent}} {{title}} {{body}} {{/each}} objectAt(0).reload() causes the corresponding item to be removed and inserted back in the same place. The problem is that the itemView

Find operation (AJAX request) rejected, not seen in the wire

梦想的初衷 提交于 2019-12-23 16:25:00
问题 In my application, I am doing several find operations. All of them are working, except one, which is being rejected. For debugging purposes, I am sending the requests during startup of the application: preloadData : function () { SettingsApp.Node.find(); SettingsApp.Locator.find(); SettingsApp.Phonelocation.find(); SettingsApp.User.find(CNST.ME_FAKE_DOC_ID); SettingsApp.Company.find(CNST.MY_ORG_FAKE_DOC_ID); }, And this is how it looks in the console: As you can see, all requests are

using baseUrl affects the path to my assets

不羁的心 提交于 2019-12-23 15:24:56
问题 I'm integrating an ember-cli app inside my main site which will be accessible at url http://host/faq/....ember...routes So I added baseUrl: /faq/ to my ember config/environment.js module.exports = function(environment) { var ENV = { modulePrefix: 'faq', environment: environment, baseURL: '/faq/', locationType: 'hash', The problem : While developing in my ember-cli environment with ember server my assets such as ( SVG, FONTS and IMAGES ) are giving me a NOT FOUND now. For example : http://host

In ember data, calling destroyRecord in a forEach loop is corrupting the loop?

邮差的信 提交于 2019-12-23 15:17:31
问题 I'm working on a simple Tag model for one of my projects. I've implemented something similar in Angular, but I wanted to give it a try in Ember. The model code is below Tag = DS.Model.extend { name:DS.attr('string') user:DS.belongsTo('user') appliedTags:DS.hasMany('AppliedTag') obliterate:()-> #destory the associated applied tags this.get('appliedTags').forEach( (appliedTag)-> console.log(Ember.inspect(appliedTag)) appliedTag.destoryRecord() ) #destory the record this.destroyRecord() }

Node.js sequelize embed hasMany IDs

≯℡__Kan透↙ 提交于 2019-12-23 15:09:53
问题 I am experimenting with a Ember app using ember-data and a node.js backend serving data from MySQL using Sequelize.js. My problem: If I have a Comment model associated to a Post model through hasMany the expected JSON by ember-data looks like { "post": { "comment_ids": [1, 2, 3] } } What would be the best way to query / generate this JSON without expensive loops etc. using sequelize? The Comment model has a foreign key with the post_id. 回答1: I went for implementing it like: // include

Block helper with ember-cli

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 13:07:58
问题 I'm trying to make a simple block helper but can't find any documentation for ember-cli on the subject UPDATED Here's the helper: import Ember from 'ember'; export default function uiInput(options) { return new Handlebars.SafeString( '<div class="ui input">' + options.fn(this) + '</div>'); } And in the template: {{#ui-input}} TEST {{/ui-input}} And the output should be: <div class="ui input"> TEST </div> But the output I'm getting is: TEST <div class="ui input"> undefined </div> What am I

Getting error: You need to pass a model name to the store's modelFor method

时间秒杀一切 提交于 2019-12-23 13:02:24
问题 Using Ember 2.6.0 Have the following routes defined: Router.map(function() { this.route('brands'); this.route('brand', {path: '/brands/:brand_id'}); }); The model for brand is: export default Model.extend({ name: attr('string'), description: attr('string'), dateCreated: attr('date'), lastUpdated: attr('date'), regions: hasMany('region') }); And the model for region is: export default Model.extend({ name: attr('string'), dateCreated: attr('date'), lastUpdated: attr('date'), brand: belongsTo(