Meteor 앱에서 작업 중이며 Backbone의 라우팅 기능과 함께 멀티 페이지 기능을 추가하려고합니다. 그러나, 나는이 수행 할 때Meteor 앱에서 백본이 정의되지 않았습니다.
meteor add backbone
meteor add underscore
다음은이 메시지와 함께 충돌 응용 프로그램 내에서 간단한 '안녕하세요 세계'를 만들려고 :
ReferenceError: Backbone is not defined
at app/backbone.js:33:2
at run (/Users/timj/Documents/backbone/.meteor/local/build/server/server.js:142:63)
at Array.forEach (native)
at Function._.each._.forEach (/usr/local/meteor/lib/node_modules/underscore/underscore.js:79:11)
at run (/Users/timothyjaeger/Documents/backbone/.meteor/local/build/server/server.js:142:7)
Exited with code: 1
확실하지 무엇을 내가 때문에 잘못하고 있어요 내 유성 애플 리케이션에 이미 백본을 추가했습니다! JS는 다음과 같습니다
는
if (Meteor.isClient) {
var AppView = Backbone.View.extend({
// el - stands for element. Every view has a element associate in with HTML content will be rendered.
el: '#container',
// It's the first function called when this view it's instantiated.
initialize: function(){
this.render();
},
// $el - it's a cached jQuery object (el), in which you can use jQuery functions to push content. Like the Hello World in this case.
render: function(){
this.$el.html("Hello World");
}
});
var appView = new AppView();
}
if (Meteor.isServer) {
Meteor.startup(function() {
Backbone.history.start({pushState: true});
// code to run on server at startup
});
}
백본도 서버에서 사용할 수 있습니다! –
그것은 할 수 있습니까 ?? 나는 그것의 가능한 방법에 너무 분실 되었는가?, 나는 그것의 더 추상적 인 조금 (모형, etc.)가 서버에 달릴다는 것을 알고있다 그러나 나는 그것의 여정 조금이 잘 수있다 생각하지 않는다 – Akshat
그럼 몇몇 클라이언트는 재료를 잘한다 라우터, 역사 등 doens't 정말 서버에서 작동합니다. 하지만 백본 모델/컬렉션을 사용하여 서버에서 데이터를 구성 할 수 있습니다. –