I have a list of routes
App.Router.map ()->
@resource 'about'
@resource 'users', ->
@resource 'repositories', path: '/:user_name/repositories'
@route 'show', path: '/:user_name'
In my users show template i also have a view
{{#view App.RepositoriesView login=login}}
<div class="show_repos_control">
<span>Show Repos</span>
</div>
{{#if reposWasQuery}}
{{#each repositories}}
{{repo_name}}
{{/each}}
{{/if}}
{{/view}}
with view class
App.RepositoriesView = Ember.View.extend({
click: function(evt) {
this.get('controller').send('showRepos', this.get('login'));
}
});
view class code process into UsersShowController with code
App.UsersShowController = Ember.ObjectController.extend({
reposWasQuery: false,
actions:{
showRepos: function(userName){
this.set('reposWasQuery', true);
this.set('repositories', jQuery.getJSON('/users/' + userName + '/repositories'));
}
}
})
Repository's data assigns as excpected, but in my view i can't dispay it. Getting error "#error some number"
It is very strange to render a
view
for a controller and route with an open close block.using
{{render 'repositories' myRepositoriesArray}}
instead will do the following:Repositories
controller with themyRepositoriesArray
as your data.RepositoriesView
.You would need to put this code:
In the
repositories
template.Ember is build with convention over configuration in mind. You should read up on the
render
helper and the things ember expects or create for you when rendering a route.