Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CodegenHelper

Companion object to assist typescript code generation. It manages the scope behind the scenes so its state changes as you call its methods. If you do not let it know about variables you declare in your typescript, there will be issues of '$scope.' being prepended to the generated code when it shouldn't be.

Hierarchy

  • CodegenHelper

Index

Constructors

constructor

  • new CodegenHelper(ngFilters: imm.List, scope: Stack, getNewVarName: function): CodegenHelper

Properties

ngFilters

ngFilters: imm.List

ngScopeInfo

ngScopeInfo: NgScopeInfo

Methods

addScopeAccessors

  • addScopeAccessors(js: string): string

declareVariable

  • declareVariable(type: string, val: string): string
  • Generate a TS expression declaring a variable of the type and value that you give. Will automatically call addScopeAccessors on the value.

    Parameters

    • type: string

      typescript type for the variable

    • val: string

      value for the variable

    Returns string

    typescript expression that registers the variable, as string.

getNewVariableName

  • getNewVariableName(): string

registerVariable

  • registerVariable(name: string): string
  • You must register a variable name when you declare a variable while generating code without going through [[generateVariable]] or getNewVariableName. Otherwise generation will add a $scope. accessor to it even though it shouldn't. Since registerVariable will return you the variable name you gave, you can use this function as a pass-through, just wrap your var name with this call.

    Parameters

    • name: string

    Returns string

Generated using TypeDoc