How to use a view model base class

A base view model class can be used to share common methods or properties with multiple view models:

import common = module("common/main");

export class BaseViewModel<T extends IVistoView> extends VistoViewModel<T> {
	showNotImplemented() {
		common.alert("Not implemented", 
			"This functionality has not been implemented yet!");
	}
}

export class MyViewModel extends BaseViewModel<IVistoView> {
	...
}

The method showNotImplemented can now be used in all views whose view model extend the BaseViewModel class.

Last edited May 11, 2015 at 4:57 PM by rsuter, version 6

Comments

No comments yet.