I`m a begginer too, and agree this case very much, but I like ember more and more. I think that ember.js has no better guides, the community should improve these, how to use the nested recourses, how to resolve the flow in the controller, router or view, etc.
For example: How to clear the pagedContent, use the willDestroy or the willDestroyElement of the View? · Issue #108 · mharris717/ember-cli-pagination · GitHub
This question is:
I add pagination to my comments of a blog, when I transate from one blog to another, the queryParams(?page=2) and the pagedNumber are still of the one.
1、How to clear the existed variables?
Becouse the ember-cli-pagination access the variables in the controller, I use the willDestroy
in the comments controller, but it has no effect. The doc of the emberjs.com says willDestroy called when App.reset(). I use the init()
, it throw a null error, The code:
willDestroy: function () {
this.set('pagedContent.totalPages', null);
this.set('totalPages', null);
}
The init() code: https://github.com/onecoinim/website.onecoin.im/blob/master/app/controllers/comments.js#L27
So I have to try another method like willDestroyElement
of the View or the deactive
of the route…
In this question, I don’t know (1) I should clear which variable, (2) where and how to clear it.
2、How to access the nested resources.
This is a very easy model: blog has many comments. I have set the routes is
this.resource('blogs',function() {
this.route('show', {path: '/:blog_id'}, function () {
this.resource('comments', function () {
this.route('new');
//this.route('show', {path: ':blog_id'});
//this.route('edit', {path: ':blog_id/edit'});
});
});
});
now it works, the demo is 원코인
But I have a question:
If i use the url 원코인 to get the same content of 원코인 , like the ruby on rails, How to do?
The demo: 원코인
The code: GitHub - ror/ember-cli-cms: A cms or blogger powered by Ember & Ember-cli
help me, thanks.
MoJie