我必须将第三方元素集成到我的Angular(4.3.x)应用程序中。他们看起来像:
<any-widget id="123"></any-widget>
我已经通过向app.module.ts添加schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
使Angular产生了没有错误。但不幸的是,我不得不做任何事情。我试过了:
<any-widget [id]="id"></any-widget>
和
<any-widget id="{{id}}"></any-widget>
但是根本没有显示id。知道如何使这项工作吗?
答案 0 :(得分:2)
#first install spatstat, maptools y sp
#load them
library(spatstat)
library(maptools)
library(sp)
#create an array of folders, will add more when everything works fine
folders=c("20170518")
for(f in folders){
#read all shp from that folder, both points and tracks
pointfiles <- list.files(paste("./",f,"/points", sep=""), pattern="*.shp$")
trackfiles <- list.files(paste("./",f,"/tracks", sep=""), pattern="*.shp$")
#for each point and track couple
for(i in 1:length(pointfiles)){
#create a linnet object with the track
t<- as.linnet(rgdal::readOGR(paste("./",f,"/tracks/",trackfiles[i], sep="")))
#plot(t)
#create a ppp object for each set of points
pre_p<-rgdal::readOGR(paste("./",f,"/points/",pointfiles[i], sep=""))
#plot(p)
#obtain the coordinates the current set of points
c<-coordinates(pre_p)
#create vector of x coords
xc=c()
#create vector of y coords
yc=c()
#not a very good way to fill my vectors but it works for my study area
for(v in c){
if(v>4000000){yc<-c(yc,v)}
else {if(v<4000000 && v>700000){xc<-c(xc,v)}}
}
print(xc)
print(yc)
#create a ppp object using the vectors of x and y coords, and a window object
#extracted from my set of points
p=ppp(xc,yc,Window(as.ppp(pre_p)))
#join them into an lpp object
pt <- lpp(p,t)
#plot(pt)
#analize it with the linearK function, nsim=9 for testing purposes
#envelope.lpp is the method for analyzing linear point patterns
assign(paste("results",f,i,sep="_"),envelope.lpp(pt, nsim=9, fun=linearK))
}#end for each points & track set
}#end for each day of study
或
<any-widget [attr.id]="id"></any-widget>
没有<any-widget attr.id="{{id}}"></any-widget>
Angular尝试绑定到HTML元素的属性或Angular指令的attr.
。如果使用的名称都不存在,则需要使用属性绑定。