Angular5 Instascan - addListener不起作用

时间:2018-02-12 18:06:20

标签: javascript angular angular5

Angular5 Instascan - addListener不工作

innerHTML>>它不起作用。但警告和功能外>>它的工作

scanner.addListener('scan', function (content) {
  //console.log(content); //It's work
  //alert(content); //It's work 
  this.text2.innerHTML=content; //It's not working.
  this.setText(content); //send to other functions >>It's not working.
});

1 个答案:

答案 0 :(得分:0)

试试这个:

scanner.addListener('scan', function (content) {
  //console.log(content); //It's work
  //alert(content); //It's work 
  this.text2 = content; // <--- Change to this
  this.setText(content); //send to other functions >>It's not working.
});

关于你的元素:

<some-element>{{text2}}</some-element>