javascriptnode.jstotal.js

Total.js Custom System View


I would like to use controller.view500(err) and display a custom system view.

How to display a custom system view 500, 400 ?

https://docs.totaljs.com/latest/en.html#api~FrameworkController~controller.view

Thank you


Solution

  • The function view500 doesn't actually render any view. It's just an alias for throw500.

    If you want to render a view you can define a custom route like this:

    F.route('#500', function(){
        // You need to create the view '500.html' file yourself in views folder
        this.view('500');
    });
    

    Then whenever you use controller.view500(); the above route will handle it. The error you pass to view500 should be available in the route controller as controller.exception