小编Pei*_*ein的帖子

角色4中的html2canvas

我可以使用角度4中的html2canvas截取屏幕截图,但我需要使用http post调用将字符串图像发送到服务器端

零件

import { Component, OnInit, NgZone } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { EventsEmitter } from '../../assets/scripts/services/eventsEmitter';
import { WindowRef } from '../../assets/scripts/services/window';
import { ImagesService } from '../images/images.component.service';
import { DomSanitizer } from '@angular/platform-browser';
import * as html2canvas from "html2canvas";


@Component({
    selector: 'categories',
    templateUrl: 'app/components/view/view.component.html',
    styleUrls: ['app/components/view/view.component.css'],
    providers: [ImagesService]
})
export class ViewComponent {
    
   

    constructor(
        private route: ActivatedRoute,
        private router: Router,
        private imagesService: ImagesService,
        private eventsEmitter: EventsEmitter
        private sanitizer: DomSanitizer,
        private …
Run Code Online (Sandbox Code Playgroud)

html2canvas angular

6
推荐指数
3
解决办法
2万
查看次数

*ng 不适用于 html 表格(角度 2)

html ngFor 不适用于 html 表格

<!DOCTYPE html>
<html>

<body>
    <div class="row">
        <div class="col-xs-12 col-md-offset-4">
            <table  class="table table-striped">
                <tr *ngFor="category of categoriesInfo" >
                    <td data-title="'Name'">
                        <a>{{category.CategoryName}}</a>
                    </td>
                    <td>
                        <button type="button" class="btn btn-sm">Delete</button>
                    </td>
                </tr>
            </table>
        </div>

    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

组件 我正在从数据库中获取数据但无法执行 ngFor ,请在下面找到错误信息

import { Component,OnInit } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { CategoriesService } from './categories.component.service';
import { EventsEmitter } from '../../../assets/scripts/services/eventsEmitter';

@Component({
    selector: 'categories',
    templateUrl: 'app/components/admin/categories/categories.component.html',
    styleUrls: ['app/components/admin/categories/categories.component.css'],
    providers: [CategoriesService]
})
export class …
Run Code Online (Sandbox Code Playgroud)

html-table ngfor angular

4
推荐指数
1
解决办法
4066
查看次数

如何使用 angular 中的自定义 css 样式覆盖 ng2-boostrap 手风琴默认样式

我正在尝试使用自定义样式覆盖 ng2-bootstrap 手风琴 css 样式,但该样式未得到应用

在此处输入图片说明

html

<ngb-accordion #acc="ngbAccordion" activeIds="ngb-panel-0">
  <ngb-panel class="customclass1" title="Simple">
    <ng-template ngbPanelContent>
      Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia
      aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor,
      sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica,
      craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher …
Run Code Online (Sandbox Code Playgroud)

css ng2-bootstrap angular

3
推荐指数
1
解决办法
2586
查看次数

在Angular 2中从html2canvas调用Typescript函数

我在Angular 2中使用html2canvas捕获网页,但是我需要使用webapi帖子调用将字符串图像发送到服务器端

imageDownload() {
    html2canvas(document.body).then(function (canvas) {
        var imgData = canvas.toDataURL("image/png");
        document.body.appendChild(canvas);
    });
}
Run Code Online (Sandbox Code Playgroud)

我无法从html2canvas访问此Typescript函数,如何访问此方法以将图像字符串发送到服务器端

AddImagesResource(image: any) {
    this.imagesService.addCanvasResource(image)
        .subscribe(response => {
            this.eventsEmitter.broadcast('Success', 'Changes Saved Succesfully');
        },
        error => {
            this.eventsEmitter.broadcast('Error', 'Error Occured');
        });
}
Run Code Online (Sandbox Code Playgroud)

html2canvas angular

1
推荐指数
1
解决办法
5630
查看次数

标签 统计

angular ×4

html2canvas ×2

css ×1

html-table ×1

ng2-bootstrap ×1

ngfor ×1