【问题标题】:Angular 5 export html to imageAngular 5将html导出到图像
【发布时间】:2019-01-25 01:00:36
【问题描述】:

请问如何将 html 导出到 Angular 5 中的图像。

书店什么的?

有没有办法用 angular 5 做到这一点?

【问题讨论】:

  • 请在您的问题中添加更多描述。

标签: angular typescript angular5


【解决方案1】:

如果你想动态添加图片的 url 链接,这里是代码。 您可以将输入文本事件更改为要存储的 HTML 链接。 模块 HTML 的 HTML:

<h1>{{title}}</h1>
<div>
        <input type="text" (input)="onInputEvent($event)">
</div>
<div>
    <a [href]='url'>
        <img 
        src="smiley.gif" 
        alt="HTML tutorial" 
        style="width:42px;height:42px;border:0;">
      </a>
</div>

模块类型脚本:

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'MY TEST';
  url:string ;
  onInputEvent(event:Event){
    this.url=(<HTMLInputElement>event.target).value;
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-10-24
    • 2021-11-25
    • 2017-12-22
    • 1970-01-01
    • 2013-07-15
    • 2012-06-08
    • 2018-07-22
    • 2017-10-11
    相关资源
    最近更新 更多