Skip to content

.removeTemplate

Peter Naydenov edited this page Dec 17, 2017 · 1 revision

Remove template/templates

tplEngine.removeTemplate ( tplName )

  • tplName: string | string[]. Templates names for remove;
  • Method return options:
    • tplEngine;
  • Method is chainable;

Example:

  const templates = {
                        'hello' : 'Hello {{user}}'             // template 'hello'
                      , 'bye'   : 'Good bye {{user}}'          // template 'bye'
                      , 'tnx'   : 'Special thanks to {{user}}' // template 'tnx'
                    }

 tplEngine.insertTemplate ( templates )
 // -> three templates were added to tplEngine: 'hello', 'bye', 'tnx'.



 tplEngine.removeTemplate ( [ 'tnx', 'bye'] )
 // -> will remove templates 'bye' and 'tnx'. Only 'hello' will stay.
 /*
     Alternative way without array:
     tplEngine.removeTemplate ( 'tnx', 'bye' )
 */