Add text from array of strings to in string in angular

醉酒当歌 提交于 2020-12-15 05:24:30

问题


This is encoder package file encoder

Am using that package in my angular (ionic) project like this.. which is working fine..

let items: string[] = ['Apple', 'Orange', 'Banana'];
   
let EscPosEncoder = require('esc-pos-encoder');

let encoder = new EscPosEncoder();

let result = encoder
    .initialize()      
     .text(' test text')
     .newline() 
   
     .encode();

The above code is working fine.. Now i need to add items details.

My code ts file :

let result = encoder
        .initialize()      
         .text('The quick brown fox jumps over the lazy dog')
         .newline()  
     
        items.forEach(function (value) {
         
         .text((value)   ---below 2 lines are dynamically add
         .newline() 

         })                   ---- how to dynamically add items?
  
        .encode();

How to dynamically append( string builder) in typescipt?please any suggest?Is it possibe with typescript//

来源:https://stackoverflow.com/questions/65228046/add-text-from-array-of-strings-to-in-string-in-angular

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!