ember.js

How can I programmatically add/remove models to a controller?

空扰寡人 提交于 2020-01-05 06:29:21
问题 This shouldn't be too hard. I have a datepicker UI widget, and each time the user clicks on a month, I want to add or remove that month from the MonthsController (an ArrayController ). The MonthsController is not associated with a route, so in my ApplicationTemplate I simply have {{render months}} A simplified version of my datepicker view is App.DatepickerView = Ember.View.extend({ click: function(e) { var id = $(this).datepicker().data('date').replace(" ", "-"); this.get('controller

Ember.js: Howto create routes that only execute code

百般思念 提交于 2020-01-05 05:58:21
问题 My app has a main view with some hidden elements that can be activated by the user. Like a typical sidebar on mobiles that slides in from the left. Or a cart that reveals the details when you tap on it. The information in those initially hidden elements is always up to date since their content is mapped in the main app template. So my routes would not need to render any DOM. The transitions are JS based. But now I want those states to be reflected in the URL, in order to get a consistent back

Emberjs: Failed to find a valid digest in the 'integrity' attribute

淺唱寂寞╮ 提交于 2020-01-05 05:39:25
问题 I'm trying run an Ember project locally : https://github.com/cosmicjs/ember-real-estate-website?files=1. I'm using pycharm 2017 using git-bash as my terminal in win7. I have npm and node installed along with the jetbrains emberjs plugin. I can start the server using : $ COSMIC_BUCKET=your-bucket-slug npm start > cosmicrealestate@1.0.0 start E:\ember-real-estate-website > node server.js When I open the browser I see nothing. In the console: Failed to find a valid digest in the 'integrity'

Ember.js: Prevent destroying of views

Deadly 提交于 2020-01-05 04:51:48
问题 I have my routes setup like this: this.resource('post',{path:":post_id"},function(){ this.resource('selectimage',{path:"selectimage/:returncontext"},function(){ }); }); Both post.index and selectimage are rendered into separate outlets: // PostIndexRoute renderTemplate: function (controller) { this.render({ outlet: 'detailColumn' }); }, // SelectimageRoute renderTemplate: function (controller) { this.render({ outlet: 'modal' }); }, When I navigate from post to post/selectimage, the post.index

Ember: unsaved models in dynamic URLs

五迷三道 提交于 2020-01-05 04:42:29
问题 I'm currently using the FixtureAdapter in my Ember app, but when I switch to the RESTAdapter, my URLs no longer work. The app is a scorekeeping type thing, and I want users to be able to log all the scores without having to be connected to the Web. After the game is finished they can optionally save all the data to the server. Now, when Ember wants to route to say, matches/:match_id, the ID isn't there because I didn't commit anything to the server/store, so my models don't yet have an ID and

Bypass/disable uppercase -> global inference in Handlebars templates?

我与影子孤独终老i 提交于 2020-01-05 04:27:04
问题 I have the following handlebars template (fragment): {{#each cbe in abs.XyzBookingEntries}} <tr> {{#if cbe.isLoaded}} <td>{{cbe.XYZdata.ApptDuration}} min:</td> <td> {{cbe.XYZdata.ApptType}} {{#if cbe.XYZdata.ApptTypeDetailCode}} ({{cbe.XYZdata.ApptTypeDetailCode}}) {{/if}} </td> <td {{bindAttr class="cbe.XYZdata.statusClass"}}><strong>{{cbe.XYZdata.ApptStatus}}</strong></td> {{else}} <td> Loading... </td> {{/if}} </tr> {{/each}} From which you can observe two things: I have capitalized

EmberJS how to handle transitionTo

陌路散爱 提交于 2020-01-05 03:38:10
问题 I have the following code which calls an transitionToRoute('search') when a search-query is entered and the enter button is pressed or submit button is clicked. However, my Router still won't show the searchQuery in the template where it says: <p>You searched for: "{{searchQuery}}"</p> and the URL looks like http://www.example.com/#/search/[object Object] when searching for something (which doesn't seem right to me). (full code can be viewed over at: http://jsfiddle.net/Mn2yy/1/) This is the

EmberJS how to handle transitionTo

血红的双手。 提交于 2020-01-05 03:38:07
问题 I have the following code which calls an transitionToRoute('search') when a search-query is entered and the enter button is pressed or submit button is clicked. However, my Router still won't show the searchQuery in the template where it says: <p>You searched for: "{{searchQuery}}"</p> and the URL looks like http://www.example.com/#/search/[object Object] when searching for something (which doesn't seem right to me). (full code can be viewed over at: http://jsfiddle.net/Mn2yy/1/) This is the

How to programatically add component via controller action in ember 2.x

╄→гoц情女王★ 提交于 2020-01-05 00:03:49
问题 I am being faced with the same problem on How to programatically add component via controller action However since I am using ember cli, I am unable to do so. Here is my source code import Ember from "ember"; export default Ember.Component.extend({ actions : { remove : function(){ this.remove(); }, add : function() { Ember.AuthorNameComponent.create().appendTo($('#authors')); } }, }); When I try to run this code, I get undefined error. Also name of component is author-name. Any help, how can

How to programatically add component via controller action in ember 2.x

主宰稳场 提交于 2020-01-05 00:02:37
问题 I am being faced with the same problem on How to programatically add component via controller action However since I am using ember cli, I am unable to do so. Here is my source code import Ember from "ember"; export default Ember.Component.extend({ actions : { remove : function(){ this.remove(); }, add : function() { Ember.AuthorNameComponent.create().appendTo($('#authors')); } }, }); When I try to run this code, I get undefined error. Also name of component is author-name. Any help, how can