vendredi 30 janvier 2015

Cannot get basic emberjs application to work on rails platform

I have a rails app that contains a StaticController with an index action:



class Private::StaticController < PrivateController

def index

end
end


routes.rb:



get 'static' => 'private/static#index'


I want to start an emberjs application in the corresponding view:



<%= javascript_include_tag 'ember_application' %>
<h1>Hello</h1>
<script type="text/x-handlebars">
<div>{{outlet}}</div>
</script>


For that I created a basic emberJS router:



PlatformUI.Router.map(function() {
this.route('test', { path: '/test' });
});

PlatformUI.Router.reopen({
rootURL: '/static/'
});


The template (in app/assets/javascripts/templates/test.handlebars) contains:



<script type="text/x-handlebars" data-template-name="test">
<h2>Something</h2>
</script>


When running the application, just the word 'Hello' is displayed on the page. The ember inspector (chrome plugin) says that emberjs is correctly loaded. Is there a problem with the routes? How can I debug this??


Gemfile:



gem 'ember-rails'
gem 'ember-source', '~> 1.9.1'




Aucun commentaire:

Enregistrer un commentaire