我可以使用角度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)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) 我正在尝试使用自定义样式覆盖 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)我在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)