Make templates work with nonempty baseUrls (e.g., IIS virtual directories)

This commit is contained in:
Steve Sanderson
2017-07-11 23:45:25 +01:00
parent bb0727c34c
commit e65ecebac6
31 changed files with 65 additions and 44 deletions

View File

@@ -1,18 +1,20 @@
import * as ko from 'knockout';
import { Route } from '../../router';
import { Route, Router } from '../../router';
interface NavMenuParams {
route: KnockoutObservable<Route>;
router: Router;
}
class NavMenuViewModel {
public router: Router;
public route: KnockoutObservable<Route>;
constructor(params: NavMenuParams) {
// This viewmodel doesn't do anything except pass through the 'route' parameter to the view.
// You could remove this viewmodel entirely, and define 'nav-menu' as a template-only component.
// But in most apps, you'll want some viewmodel logic to determine what navigation options appear.
this.route = params.route;
this.router = params.router;
this.route = this.router.currentRoute;
}
}