我在angular应用程序的[System.Xml.Serialization.XmlElementAttribute("Shifts", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public ShiftMes[] Shifts { get; set; }
文件夹中直接有一个文件夹_files
。 src
文件夹包含一个json _files
。我想使用_productlist.json
,但无法添加此导入路径。
在_productlist.json
中,我添加了compilerOptions
。我尝试添加这些选项,但不起作用
baseUrl": "./src"
如何成功导入以使用json文件?
答案 0 :(得分:0)
您可以在tsconfig.json中修改路径字段以创建导入别名
/ # cat /etc/resolv.conf
nameserver 10.244.0.14
#nameserver 10.96.0.10
search weika.svc.cluster.local svc.cluster.local cluster.local
options ndots:5
/ # ping stackoverflow.com
PING stackoverflow.com (151.101.65.69): 56 data bytes
64 bytes from 151.101.65.69: seq=0 ttl=49 time=100.497 ms
64 bytes from 151.101.65.69: seq=1 ttl=49 time=101.014 ms
64 bytes from 151.101.65.69: seq=2 ttl=49 time=100.462 ms
64 bytes from 151.101.65.69: seq=3 ttl=49 time=101.465 ms
64 bytes from 151.101.65.69: seq=4 ttl=49 time=100.318 ms
^C
--- stackoverflow.com ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 100.318/100.751/101.465 ms
/ #
现在您可以像这样导入它
{
...
"compilerOptions": {
....
"paths": {
"_files/*": ["_files/*"]
}
}
}