So i have these script includes:
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script>
<script src="js/vendor/ember-1.0.0-pre.2.min.js"></script>
<script src="js/vendor/handlebars-1.0.rc.1.js"></script>
<script src="http://yui.yahooapis.com/3.7.3/build/yui/yui-min.js"></script>
<script src="js/main.js"></script>
This in my head tag:
<script type="text/x-handlebars" data-template-name="application">
WTF
</script>
And this in my main.js:
window.Stocks = Ember.Application.create();
Stocks.Router = Em.Router.extend({
initialState: 'root.home',
root: Em.Route.extend({
home: Em.Route.extend({
view: Stocks.CurrentStocksView
})
})
});
Stocks.CurrentStocksView = Ember.View.extend({
templateName: 'application',
appendTo: function() {
this._super('#current');
}
});
// Startup call
Stocks.initialize();
And i’ve totally lost the way. I just want to print “WTF” bewteen the . And do i need to include the script tag voor handlebars?
First, you seems to use
ember 1.0.0-pre2. So you don’t have to specifyStocks.initialize()unless you set theautoinitEmber.Applicationproperty to false:Next, you should include
Handlebarsbefore loading ember:And it should work, as you can see in this JSFiddle.