ember.js

Double condition with #if

别说谁变了你拦得住时间么 提交于 2019-12-21 09:29:31
问题 How to do a double condition {{#if person && work}} ? The && seems not a valid operator 回答1: I don't believe handlebars supports multiple items in the {{#if}} statement (related: Logical operator in a handlebars.js {{#if}} conditional). You could collapse the multiple values in your controller/view into a single computed property and check that single value in the template. This new computed property will update when either of the original values update: App.ValuesTestController = Ember

Difference between this.get('model') and modelFor

不想你离开。 提交于 2019-12-21 09:27:11
问题 I am quite new to ember and don't really get the difference between two types of syntax. Where and in which situations should i use one or another. I.e. Which one is more suitable for usage in Routes and which one for Controllers. this.get('model') As opposed to this.modelFor('artists/show') 回答1: this.get('model') //controller call this.modelFor('someRoute') //route call In Ember, a routes setupController hook by default performs this one line of code: setupController: function(controller,

emberjs 2 connect to an api flask - Encountered a resource object with an undefined type

我的未来我决定 提交于 2019-12-21 09:24:15
问题 I'm learning Ember and after some basic test, I tried to connect with my API to created a search component. API 'application/vnd.api+json' { "data": [ { "expediente": "1717801", "fecha_de_presentacion": "01/02/2016 12:00:00 AM", "figura_juridica": "REGISTRO DE MARCA", "logotipo": null, "signo": "IGUY", "tipo": "NOMINATIVA", "titular": "SAMSONITE IP HOLDINGS S.\u00c0.R.L." }, { "expediente": "1717793", "fecha_de_presentacion": "01/02/2016 12:00:00 AM", "figura_juridica": "REGISTRO DE MARCA",

Defining a multi segmented catch all route in ember.js

与世无争的帅哥 提交于 2019-12-21 09:23:07
问题 I am using Ember.js and I would like to create a catch all route to send the user back to the root of the application if they navigate to a URL that does not match a resource. (I am using the history API) I have implemented this like so: App.Router.map(function() { this.resource('things', function() { this.resource('thing', {path:':thing_id'}); }); this.route('catchAll', { path: ':*' }); this.route('catchAll', { path: ':*/:*' }); this.route('catchAll', { path: ':*/:*/:*' }); }); App.Router

Trying to understand Ember JS promises

爷,独闯天下 提交于 2019-12-21 09:07:56
问题 I have been trying to work on a code example to get my head around promises. But I can't seem to figure out how to deal with the callbacks and get the "thenable" value later. Here are two relevant JSBin examples I am working on. Written in verbose style to emulate baking cookies. Ember JS without async http://jsbin.com/iSacev/1/edit purely synchronous example to show the basic behavior (deliberately using basic object model) Ember JS with async and promises http://jsbin.com/udeXoSE/1/edit

How to focus after initialization with emberjs?

爱⌒轻易说出口 提交于 2019-12-21 07:58:08
问题 I'm new to Ember.js. I want to focus on TextField(in sample, id="text") after initialization, but in ready function, doesn't work focus method... <body> <!-- library load --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script> <script>!window.jQuery && document.write(unescape('%3Cscript src="js/libs/jquery-1.6.1.min.js"%3E%3C/script%3E'))</script> <script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-0.9.5.min.js"></script> <script type=

jshint complains: 'Ember' is not defined

房东的猫 提交于 2019-12-21 07:29:12
问题 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

Why don't the arguments to create() behave more like setProperties()?

空扰寡人 提交于 2019-12-21 07:29:12
问题 Something I find very counter-intuitive about Ember is you can overwrite a computed property setter functions ( http://emberjs.com/#toc_computed-properties-setters ) with the arguments to create() . See http://jsfiddle.net/zJQJw/2/ I found the best workaround for this is to call create().setProperties(properties) instead of create(properties) , but this seems like an unnecessary gotcha to me. I realize it might break some apps at this point, but would you consider making create() behave more

Ember.js Ember Simple Auth persist authentication information in LocalStorage does not work

旧巷老猫 提交于 2019-12-21 06:23:51
问题 I use Ember Simple Auth with the following settings: Note: I use Ember App Kit. app.js // init Ember.SimpleAuth App.initializer({ name: 'authentication', initialize: function(container, application) { Ember.SimpleAuth.setup(application, { // @todo at version 0.1.2 of Ember-simple-auth, add container variable crossOriginWhitelist: ['http://customdomain'], // store: Ember.SimpleAuth.Stores.LocalStorage, // default now authenticationRoute: 'article.login' }); } }); export default App; a simple

Break up my application.handlebars into separate templates using Ember.js and Ember.Router

丶灬走出姿态 提交于 2019-12-21 06:08:28
问题 I'm building a front-end (on top of Ruby on Rails) using ember.js and the ember-rails gem. My (ember) application consists of Models, Views, Controllers and an application.handlebars template which describes my UI. Whats the best practice to break up this application.handlebars file so that I can manage the UI? For example, I'd like to have Navigation at the top of the page. I've tried using the Ember.Router , a separate navigation.handlebars (with NavigationView and NavigationController) the