backbone

how to reach another container from a dockerised nginx

匿名 (未验证) 提交于 2019-12-03 08:51:18
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have nginx in a docker container, and a nodejs webapp in another docker container. The nodejs server is reachable from the host server on port 8080. The nginx docker container is listening to port 80 (will do the certificate later, first this base must be working). And now I want a subdomain to be forwarded to this 8080 nodejs app. lets say app1.example.com From outside I can reach the app by te server ip (or hostname) and port 8080 but not on app1.example.com. And it does work on app1.example.com:8080 (I have opened up port 8080 on the

backbone view - is not defined

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: This really confuses me, I think I'm stupid but I've searched and have done whatever I could. Whenever I declare a view and run BDD test with jasmine, it always returns "undefined is not a function". This is code window.LocationView = Backbone.View.extend({ initialize: function() { // create new marker first this.marker = new google.maps.Marker({ title: this.model.get('name'), draggable: true, animation: google.maps.Animation.DROP, position: new google.maps.LatLng(this.model.get('lat'), this.model.get('long')), // give the position here });

Backbone Collection of polymorphic Models

匿名 (未验证) 提交于 2019-12-03 08:41:19
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a collection of Animals. App.Collections.Animals extends Backbone.Collection model: App.Animal url: '/animals/' #returns json And these animal classes: App.Models.Animal extends Backbone.Model App.Models.Monkey extends App.Models.Animal defaults:{type:'Monkey'} App.Models.Cat extends App.Models.Animal defaults:{type:'Cat'} App.Models.Dog extends App.Models.Animal defaults:{type:'Dog'} When collection is filled with JSON (records contain the type attribute) I want models to be instantiated as sub-classed models (Monkey,Cat,Dog) and not

How to know when a Backbone model.fetch() completes?

匿名 (未验证) 提交于 2019-12-03 08:35:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I bind on the change event of my backbone models like this. this.model.on( "change", this.render, this ); Sometimes I want to fetch the latest version of the model and forcibly render the view. So I do this this.model.fetch(); Unfortunately model.fetch() only fires the change event if the new data is different from what was previously stored in the model. How can I always trigger a this.render callback when fetch completes, whether it triggers a change event or not? Thanks (in advance) for your help 回答1: You can use the $.ajax success

Backbone, Bootstrap modal within template not showing

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to generate a modal for each of my posts so that each post has a modal containing the post content(and eventually comments). When the comment link is clicked the modal will appear. The thing is I have to create a bootstrap modal block for each post so i decided it would be easiest to do this in my backbone template. Why isn't this working? Here is my code: app/assets/templates/posts/index.jst.eco <% for post in @posts.models: %> <tbody><td> <%= post.get('content') %> </td></tbody> <tr><td> <a href="#<%= post.get('id') %>">Comment

Backbone model.save returning error while server sending 200:OK

匿名 (未验证) 提交于 2019-12-03 07:50:05
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have defined the following Backbone Model: var User = Backbone . Model . extend ({ url : "/login" , contentType : "application/com.example.auth+json" , defaults : { userName : '' , password : '' }, validate : function ( attrs ){ if (! attrs . userName ){ return 'Please fill username field.' } if (! attrs . password ){ return 'Please fill password field.' } } }); I am using the following code in my Backbone.View // ... initialize : function () { this . model = new User (); myUser = { userName : 'labuser1@example.com' , password :

Understanding Backbone and Marionette View lifecycle

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm new to this world and I need to understand some of the concepts of Backbone and Marionette. Here I'm trying to explain some of the concepts I'm learning. It would be great to having some feedback on them. The render function defines the logic for rendering a template. When it is finished, the onRender callback is called. Here I suppose the rendered view has been not attached to the DOM. It is composed by a tagName (the default is div ) that contains the template I attached to it. To explicitly insert that tag into the DOM I

How can I use JointJS with an application built with Angular CLI?

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have installed jointjs via npm and also installed typings and code compiles/builds fine. Code import { Component } from '@angular/core' ; import * as joint from '../../node_modules/jointjs/dist/joint.min' ; export class AppComponent { title = 'app works!' ; constructor ( ) { // console.log(joint)// private jint: joint, } ngOnInit () { var graph = new joint . dia . Graph ; } } Error shows up on the browser: Failed to compile . / home / vinay / angularapps / jjs / src / app / app . component . ts ( 17 , 31 ): Property 'Graph' does

Override backbone &#039;set&#039; method

匿名 (未验证) 提交于 2019-12-03 03:00:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to override backbone set method so that whenever I set a value to backbone Model the callbacks registered on that attribute get called without checking for same previous value of that attribute . var model = Backbone.Model.extend({ defaults : { prop1 : true } }); var view = Backbone.View.extend({ initialize : function(){ this.listenTo(this.model,"change:prop1", this.callback); }, callback : function(){ // set is called on prop1 } }); var m1 = new model(); var v1 = new view({model:m1}); m1.set("prop1",true); // It doesn't trigger

Backbone reset event in collection

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How does Backbone reset event works? As far as I understand Remove all models from collection Add newly "fetched" models to collection Fires reset event In my case each model draw something on SVG so I should call remove function before removing model from collection. Which event is triggered when model is removed from collection? 回答1: As @Paul noted, there is no predefined event fired before a reset . However, you can provide your own by overriding the reset method on your collection. For example, var SVGCollection = Backbone.Collection