0

I have two button which redirect to the same page. One button should redirect to the page in readonly mode, the other button should redirect to the editable page. I use the router to redirect and I think I should manage the readonly in the router but I don't know how

1 Answers1

1

You can catch route change via listen in your ViewController.

Example:

listen: {
    controller: {
        '#': {
            unmatchedroute: 'onRouteChange'
        }
    }
}

Let's suppose the name of read page is page1:read and edit is page1:edit. (so url should be like that : {site}/#page1:read )

onRouteChange: function (arg) {
    var parts = arg.split(":");
    var page = parts[0];
    var method = parts[1];
    //now change content to page and set method (read or edit) 
}
norbeq
  • 2,923
  • 1
  • 16
  • 20