This.resource deprecation and loading/error route handling


#1

Since this.resource is going to be deprecated, how are loading and error routes handled/generated in Ember 2.0?

http://guides.emberjs.com/v1.10.0/routing/loading-and-error-substates/


#2

As I see, nothing has changed with routes - http://guides.emberjs.com/v1.11.0/routing/loading-and-error-substates/


#3

True, but defining a route in the router does not generate loading and error substates. Do I need to do this manually from now on?


#4

@Eptis I believe it does if you include the template, controller or router.


#5

The loading/error states are generated for .route()'s so long as there is a nested function (usually for sub-routes). Ex:

    this.route('foo'); // no loading/error
    this.route('bar', function(){ // YES loading/error
        this.route('baz'); // no loading/error
    });
    this.route('foobarbaz', function(){}); // YES loading/error

The last I heard, there was discussion about just making those sub-state routes for every route, but that was some time ago.


#6

Thanks @Panman8201for clearing this up :slight_smile: