我在Angular应用中使用数据表。安装数据表后,我面临以下错误:
import folium
import branca
import os
import json
import numpy as np
#import vincent
from folium import IFrame
import pandas as pd
import numpy.ma as ma
import base64
import matplotlib.pyplot as plt
def make_data():
x = np.linspace(-np.pi, np.pi, 101)
sin = np.sin(x)
cos = np.cos(x)
cos[20:50] = np.NaN
return pd.DataFrame(np.asanyarray([sin, cos]).T, columns= ['sin', 'cos'], index=x)
df = make_data()
resolution, width, height = 75, 7, 3
station = '42'
lon, lat = -42, -21
mapa = folium.Map(location=[lat, lon], zoom_start=5)
encoded = base64.b64encode(open('P8290065.JPG', 'rb').read()).decode()
html = '<img src="data:image/JPG;base64,{}">'.format
iframe = IFrame(html(encoded), width=632+20, height=420+20)
popup = folium.Popup(iframe, max_width=2650)
icon = folium.Icon(color="blue", icon="ok")
marker = folium.Marker(location=[lat-2, lon+1], popup=popup, icon=icon)
mapa.add_child(marker);
mapa.save("MapImage.html")
有人可以告诉我我应该怎么做吗?
答案 0 :(得分:2)
您正在将库用于AngularJS
。使用https://github.com/l-lin/angular-datatables/代替
答案 1 :(得分:-1)
要使用angular-datatables,您需要安装Node 10或更高版本以及NPM 6或更高版本。
该演示是在版本8.Y.Z和更高版本的Angular-CLI中开发的。
您需要先安装其依赖项,然后才能使用NPM获取最新版本:
npm install jquery --save
npm install datatables.net --save
npm install datatables.net-dt --save
npm install angular-datatables --save
npm install @types/jquery --save-dev
npm install @types/datatables.net --save-dev
将脚本和样式属性中的依赖项添加到angular.json:
{
"projects": {
"your-app-name": {
"architect": {
"build": {
"options": {
"styles": [
"node_modules/datatables.net-dt/css/jquery.dataTables.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js"
],
...
}
在应用的适当级别导入DataTablesModule。
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { DataTablesModule } from 'angular-datatables';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
DataTablesModule
],
providers: [],
bootstrap: [ AppComponent ]
})
export class AppModule {}
如果遇到以下错误:
ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 194:50 in the original .ts file), resolving symbol NgModule in /home/l-lin/projects/angular-datatables/demo/node_modules/angular-datatables/node_modules/@angular/core/core.d.ts, resolving symbol DataTablesModule in /home/l-lin/projects/angular-datatables/demo/node_modules/angular-datatables/src/angular-datatables.module.ts, resolving symbol DataTablesModule in /home/l-lin/projects/angular-datatables/demo/node_modules/angular-datatables/src/angular-datatables.module.ts
请更新您的tsconfig.json并添加以下块:
{
"compilerOptions": {
...
"paths": {
"@angular/*": [
"../node_modules/@angular/*"
]
}
}
}