View parameters

The view parameters object provides access to the view's parameters which are passed from the instantiating view or client. The object implements the TypeScript interface VistoParameters with the following methods:
  • setValue(key: string, value): Sets a value on the parameters object
  • getValue(key: string, defaultValue?): Returns a value
  • *getObservable(key: string, defaultValue?): Returns a value as an observable
  • getObservableArray((key: string, defaultValue?): Returns a value as an observable array

Two-way bindings

The methods getObservable() and getObservableArray() are used to get a parameter as Knockout observable. If an observable is passed directly as parameter it is returned as it is, otherwise the value is wrapped within a new observable. Using this mechanism, it is possible to implement views with two-way bindings by "injecting" observables into a new view instance which are updated within the view.

Last edited Jun 24, 2013 at 4:15 PM by rsuter, version 1

Comments

No comments yet.