//- -var variable = {name: 'SaleOrderDetailViewModel', bindTo: "/edus", children: [{name:'name1',class:'Class'},{name:'name2',class:'Class'}], commands: [{code: 'formLoad'}, {code: 'removeItem', params: [{name: 'listPath', value: 'WLList'}, {name: 'listPath', value: 'WLList'}]}, {code: 'removeItem', params: [{name: 'listPath', value: 'WLList'}]}, {code: 'removeItem', params: [{name: 'listPath', value: 'WLList'}], paramDescriptions:[{name: 'listPath', type: 'string'}]}]};

| import { Injectable } from '@angular/core';
| import { ViewModel, NgCommand } from '@farris/devkit';
| import { Observable } from 'rxjs';
= '\n'
if (variable.children && variable.children.length)
  each item, index in variable.children
    | import { #{variable.externalPrefix}#{item.class} } from './#{item.class.toLowerCase()}';
    = '\n'
|
| @Injectable()
| export class #{variable.externalPrefix}#{variable.name} extends ViewModel {
= '\n'
|   public bindingPath = '#{variable.bindTo}';
= '\n'
= '\n'
|   public dom = !{variable.dom};
= '\n'
= '\n'
if (variable.children && variable.children.length)
  | public childViewModels={
  = '\n'
  each item, index in variable.children
    |    '#{variable.externalPrefix}#{item.class}' : '#{item.name}'
    if (index < variable.children.length-1)
      | ,
    = '\n'
  | }
= '\n'
if (variable.children && variable.children.length)
  each item, index in variable.children
    |   public #{item.name}: #{variable.externalPrefix}#{item.class};
    = '\n'
= '\n'
if (variable.commands && variable.commands.length)
  each command in variable.commands
    |   @NgCommand({
    |     name: '#{command.code}'
    if command.params
      |,
      = '\n'
    if command.params
      |     params: {
      = '\n'
      each param, index in command.params
        |       #{param.name}: '!{param.value}'
        if (index<(command.params.length-1))
          | ,
          = '\n'
      = '\n'
      |     }
      if command.paramDescriptions
        | ,
        = '\n'
        |     paramDescriptions: {
        ='\n'
        each paramDesc, index in command.paramDescriptions
          |       #{paramDesc.name}: { type: '!{paramDesc.type}' }
          if (index<(command.paramDescriptions.length-1))
            | ,
          = '\n'
        |     }
    = '\n'
    if(command.shortcut)
      |  ,
      |  keyBinding:{
      = '\n'
      |  ctrlKey:#{command.shortcut.ctrl},
      = '\n'
      |  altKey:#{command.shortcut.alt},
      = '\n'
      |  shiftKey:#{command.shortcut.shift},
      = '\n'
      |  key:'#{command.shortcut.key}'
      = '\n'
      |}
    |})
    |   public #{command.code}(commandParam?: any): Observable<any> { return; }
    = '\n'
    = '\n'
| }
= '\n'
= '\n'