ember

jshint complains: 'Ember' is not defined

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a standard Ember main.js file, which starts like this: this.App = Ember.Application.create({ LOG_TRANSITIONS: true, VERSION: '1.0.0', ready: function () { console.log('App version: ' + App.VERSION + ' is ready.'); } }); Running this through jshint complains about Ember not being defined, which is true for this particular file in the server, during the deployment phase. Because of this, lots of error messages are shown. Ember is made available in the browser by the script tag in index.html : <script src="scripts/vendor/ember-1.0.0-rc.2

Using grunt handlebars together with ember, to split templates in separate files

匿名 (未验证) 提交于 2019-12-03 02:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to split my ember.js handlebars templates in several files, in order to make the code base more manageable. Since we are using yeoman/grunt, I have come across this handlebars plugin . I have configured it as follows: handlebars: { compile: { options: { namespace: 'JST' }, files: { '<%= yeoman.dist %>/scripts/templates.js': [ '<%= yeoman.app %>/templates/*.hbs' ], } } } As suggested in the "Usage examples" section of the plugin. This is working as expected, generating a dist/scripts/templates.js file. But putting the templates in

Ember.js &amp; REST API

匿名 (未验证) 提交于 2019-12-03 02:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: From all the various examples of Ember.js, I have not been able to figure out if there is a default method in Ember.js to do REST AJAX calls. Many examples build their own interfaces for CRUD operations. I even tried to sift through the code to find any reference to AJAX calls but came up with nothing. So, my question is, is there a default implementation of REST API in Ember.js. If yes, how do I use it? Also if, for a specific application, I want to build custom CRUD methods, where do I plug these into Ember.js? 回答1: [2014-02-18: Deprecated

Rails and ember with acts-as-taggable-on. How to handle relationships in JSONAPI endpoint?

匿名 (未验证) 提交于 2019-12-03 02:42:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a Rails 5 (or 4) application and I need a good tag system. First question : is acts-as-taggable-on still a good choice? This is my code: class User < ActiveRecord :: Base acts_as_taggable_on : tags end class UsersController < ApplicationController def user_params params . require (: user ). permit (: name , : tag_list ) end end @user = User . new (: name => "Bobby" ) I'm able to add and remove with this (from Rails console or code): @user . tag_list . add ( "awesome" ) @user . tag_list . remove ( "awesome" ) Second question

emberjs append works but raises Assertion Failed error

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm new to ember I am trying to append a template to another and it seems to work but it raises an error, can you please explain why? The error: Assertion failed: You cannot append to an existing Ember.View. Consider using Ember.ContainerView instead This is the code in app.js App.NewStickie = Ember.View.extend({ click: function(evt){ var stickie = Ember.View.create({ templateName: 'stickie', content: 'write your notes here' }); stickie.appendTo('#stickies'); } }); These are the contents of index.html <script type="text/x-handlebars"> {{

Ember get not getting certain attribute

匿名 (未验证) 提交于 2019-12-03 02:31:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When running the following from the UserController on Google Chrome, with ember-couchdb-kit-0.9 , Ember Data v1.0.0-beta.3-56-g8367aa5 , Ember v1.0.0 , and this couchdb adapter : customerSignUp: function () { var model = this.get('model'); var customer = this.get('store').createRecord('customer', { description: 'Why hello sir', user: model }); customer.save().then(function() { model.set('customer', customer); model.save(); }); } with these models: App.User = App.Person.extend({ name: DS.attr('string'), customer: DS.belongsTo('customer',

add/delete items from Ember Data backed ArrayController

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using an ArrayController in my application that is fed from a Ember Data REST call via the application's Router: postsController.connectOutlet('comment', App.Comment.find({post_id: post_id})); For the Post UI, I have the ability to add/remove Comments. When I do this, I'd like to be able to update the contentArray of the postsController by deleting or adding the same element to give the user visual feedback, but Ember Data is no fun: Uncaught Error: The result of a server query (on App.Comment) is immutable. Per sly7_7's comment below, I

ember data serializer data mapping

匿名 (未验证) 提交于 2019-12-03 02:22:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using ember & ember-data to try and consume a json feed from the server. Here is my code: App = Ember . Application . create (); DS . RESTAdapter . configure ( "plurals" , { category : 'categories' } ); App . Store = DS . Store . extend ({ revision : 12 , adapter : DS . RESTAdapter . create ({ url : 'app' }) }); App . Router . map ( function (){ this . resource ( 'categories' ); }); App . CategoriesRoute = Ember . Route . extend ({ model : function () { return App . Category . find (); } }); var attr = DS . attr ; App .

How to use a custom Express server with Ember CLI?

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Ember CLI 0.0.36. When I run ember server in my project folder, my understanding is that a server buried in some Brocoli process gets started. However I would like to program a custom Express server and have my app point to that Node.js code for its backend. How would I go about doing that within the Ember CLI framework? UPDATE: Following @user3155277's answer , I added an adapter file like so: app-name/app/adapters/application.js : import DS from 'ember-data'; export default DS.RESTAdapter.reopen({ namespace: 'api' }); I created

Workflow for Ember-simple-auth, Torii and Facebook Oauth2

匿名 (未验证) 提交于 2019-12-03 01:58:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: After my previous question about ember-simple-auth and torii , I successfully authenticate my users with their Facebook accounts. But currently, torii's provider facebook-oauth2 is returning an authorization code from Facebook ; when the promise resolves, I send this authorization code to my backend where I perform a request against Facebook to get the user's id and email : then I authenticate the user on my backend, generating a specific access token and sending back to my ember application. Client code : // app/controllers/login