如何在Angular中使用Google GeoChart?我想在geoChart中注入角度数据,例如Javascript中的这些示例https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=it#Regions
function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
['Country', 'Popularity'],
['Germany', 200],
['United States', 300],
['Brazil', 400],
['Canada', 500],
['France', 600],
['RU', 700]
]);
var options = {};
var chart = new google.visualization.GeoChart(document.getElementById('regions_div'));
chart.draw(data, options);
}
Run Code Online (Sandbox Code Playgroud)
一些忠告?
我有这样的事情:
ng build --prod --no-aot
Run Code Online (Sandbox Code Playgroud)
但我无法理解它们之间的区别
ng build --prod
Run Code Online (Sandbox Code Playgroud)
和
ng build --prod --no-aot
Run Code Online (Sandbox Code Playgroud) 我想提供带有ion-select 的选择选项。我在第一个位置手动添加了全选选项,当我全选视图未更新时。如何更新视图?
<ion-select multiple="true">
<ion-option (ionSelect)="allClicked()">select all</ion-option>
<ion-option *ngFor="let item of students ; let i = index" [selected]="item.checked" [value]="item">{{item.studentName}}</ion-option>
</ion-select>
Run Code Online (Sandbox Code Playgroud)
.ts
allClicked(){
if(this.isAll){
console.log(this.isAll)
this.isAll = false;
for (let temp of this.students) {
temp.checked = false;
}
}else{
this.isAll = true;
for (let temp of this.students) {
temp.checked = true;
}
}
console.log("all select event ");
}
Run Code Online (Sandbox Code Playgroud) $ avdmanager create avd -n test -k "system-images;android-24;google_apis;x86"
Run Code Online (Sandbox Code Playgroud)
错误:所选包的无效--tag默认值.
如何解决这个错误?
我在Angular 5项目中使用Typescript导入svg.js及其插件遇到困难。
使用npm我安装了:
svg.js
在ticket.component.ts中:将svg.js导入为Svg类型,这样我就可以绘制矩形,此代码有效:
import * as Svg from 'svg.js'
...
export class TicketComponent implements OnInit {
ngOnInit() {
let draw = Svg('ticket-svg').size(1000, 500);
let rect = draw.rect(800, 300).attr({fill: '#fff', stroke: '#000', 'stroke-width': 1});
}
...
}
Run Code Online (Sandbox Code Playgroud)
但是我不能使用svg.draggable插件中的函数,因为它没有被导入:
rect.draggable()
// TS2339: Property 'draggable' does not exist on type 'Rect'.
Run Code Online (Sandbox Code Playgroud)
我想要这样的东西:
import * as Svg from {'svg.js', 'svg.draggable.js', 'svg.whatever.js'}
Run Code Online (Sandbox Code Playgroud)
在svg.draggable.js的GitHub示例代码中,他们只是在html中添加了这两行,仅此而已:
<script src="svg.js"></script>
<script src="svg.draggable.js"></script>
Run Code Online (Sandbox Code Playgroud)
在与打字稿成角度的字体中,这是完全不同的,因为我需要在ticket.component.ts文件而不是html中导入。
那么,如何从node_modules导入具有多个插件的svg.js作为Svg类型呢?
更新1:
我阅读了有关导入这些第三方js库类型的建议,因此我安装了:
"@types/svg.js": "^2.3.1",
"@types/svgjs.draggable": "0.0.30"
Run Code Online (Sandbox Code Playgroud)
更新2:
试图将两个js文件合并为一个文件并导入合并的版本,但是由于某种原因,这种骇人听闻的方法也不起作用...
提前致谢!
我在使用MatTabsModuleAngular Material 时遇到过这种奇怪的行为。尽管控制台中没有错误,但当我单击选项卡时,选项卡标题会拉伸。
<nav mat-tab-nav-bar>
<a mat-tab-link>
Tab1 (click me to see the bug)
</a>
<a mat-tab-link>
Tab2
</a>
</nav>
Run Code Online (Sandbox Code Playgroud)
我再说一遍,控制台中没有错误。我的依赖项是:
"dependencies": {
"@angular/animations": "^5.1.1",
"@angular/cdk": "5.0.0-rc.3",
"@angular/common": "^5.1.1",
"@angular/compiler": "^5.1.1",
"@angular/core": "^5.1.1",
"@angular/forms": "^5.1.1",
"@angular/http": "^5.1.1",
"@angular/material": "5.0.0-rc.3",
"@angular/platform-browser": "^5.1.1",
"@angular/platform-browser-dynamic": "^5.1.1",
"@angular/router": "^5.1.1",
"core-js": "^2.4.1",
"rxjs": "^5.5.5",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "^1.6.7",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": …Run Code Online (Sandbox Code Playgroud) 我不知道为什么,但只有在生产中才出现一些材质图标,正如您从图像中看到的,第一个图标丢失了:
这是代码:
<mat-nav-list>
<a mat-list-item routerLink="/dashboard" matTooltip="dashboard">
<mat-icon matListIcon>bar_chart</mat-icon>
</a>
<a mat-list-item (click)="routeToContacts()" matTooltip="contacts">
<mat-icon matListIcon>people</mat-icon>
</a>
Run Code Online (Sandbox Code Playgroud) 如何过滤输入文本中的数组对象 - 角度\n我正在尝试创建一个搜索栏来过滤用户可以搜索我将其命名为“传感器”的位置/描述的位置。
\n\n validateForm: FormGroup;\n rowData: templogRecord[] = [];\n option: any = [];\n\n onLoad() {\n this.rowData = record.default.records;\n\n this.option = [];\n\n this.rowData.forEach(room => {\n this.option.push({\n tooltip: {\n formatter: "{a} <br/>{b} : {c}\xc2\xb0"\n },\n toolbox: {\n show: true,\n feature: {\n mark: { show: false },\n restore: { show: false },\n saveAsImage: { show: false }\n }\n },\n series: [\n {\n name: room.sensor,\n type: \'gauge\',\n center: [\'40%\', \'70%\'],\n splitNumber: 10,\n radius: \'70%\',\n axisLine: {\n lineStyle: {\n color: [[0.2, \'#48b\'], …Run Code Online (Sandbox Code Playgroud) 有一点空闲时间,我尝试用我喜欢的新网络技术(Typescript、Pug 和 React)重新设计我的一个旧项目。一切都工作正常,直到我尝试将 pug.js 添加到与babel-plugin-transform-react-pug.
无论我如何摆弄配置,我都无法让构建阶段正常工作并出现以下错误:
ERROR in ./node_modules/uglify-js/tools/node.js
Module not found: Error: Can't resolve 'fs'
ERROR in ./node_modules/resolve/lib/sync.js
Module not found: Error: Can't resolve 'fs'
ERROR in ./node_modules/resolve/lib/async.js
Module not found: Error: Can't resolve 'fs'
ERROR in ./node_modules/pug-load/index.js
Module not found: Error: Can't resolve 'fs'
ERROR in ./node_modules/jstransformer/index.js
Module not found: Error: Can't resolve 'fs'
ERROR in ./node_modules/clean-css/lib/reader/load-original-sources.js
Module not found: Error: Can't resolve 'fs'
ERROR in ./node_modules/clean-css/lib/reader/apply-source-maps.js
Module not found: Error: Can't resolve 'fs'
ERROR in …Run Code Online (Sandbox Code Playgroud) 我正在开始使用Serilog,但我不知道如何将 ILogger 依赖项注入到我的类中。如果我使用 ASP.NET Core 5,这很容易,但我使用的是 .NET Core 控制台应用程序。我怎样才能做类似的事情?
public class TestStrategy
{
private static readonly ILog _logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType.Name);
...
}
Run Code Online (Sandbox Code Playgroud)
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json")
.Build();
var logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
Run Code Online (Sandbox Code Playgroud)
我必须 DIlogger进入所有课程吗?