Closed stormpat closed 7 years ago
I actually already implemented this, its very straight forward (using jQuery as its a hard dependency). I was thinking about doing a another solution with promises, but im not sure if its necessary, as guards mostly just check for some flag to be true or false.
I could make a PR, still have to write tests.
Sounds good. Please send a PR.
This is already merged, closing!
Would be useful if you could pass an array of functions to a guard/beforeShow etc. this way each route could compose what kind of validation/methods should run.
Something like:
<div data-bind="page: { id: 'somePage', guard: 'validate, doAsync, finalize' }" ></div>
or as an array
<div data-bind="page: { id: 'somePage', guard: [validate, doAsync, finalize] }" ></div>