我正在使用angular6.i,它具有一个引导管理仪表板模板。我正在尝试在angular应用程序中导入该模板,但是在Angular帮助中未采用外部js引用,如何导入以及如何在angular 6项目帮助中引用外部Js / CSS!
我尝试将所有CSS和js放在angular.json文件中。 “样式”:[],“脚本”:[]是 没有工作。 已经观察到浏览器控制台中没有错误。
"styles": [
"src/styles.css",
"assets/css/font-awesome.min.css",
"assets/css/metisMenu.css",
"assets/css/typography.css",
"assets/css/default-css.css",
"assets/css/styles.css",
"assets/css/responsive.css"
],
"scripts": [
"assets/js/vendor/jquery-2.2.4.min.js",
"assets/js/metisMenu.min.js",
"assets/js/jquery.slimscroll.min.js",
"assets/js/jquery.slicknav.min.js",
"assets/js/scripts.js",
"assets/js/vendor/modernizr-2.8.3.min.js"
]
#Angular.json
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"MDProject": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"targets": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/MDProject",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css",
"assets/css/font-awesome.min.css",
"assets/css/metisMenu.css",
"assets/css/typography.css",
"assets/css/default-css.css",
"assets/css/styles.css",
"assets/css/responsive.css"
],
"scripts": [
"assets/js/vendor/jquery-2.2.4.min.js",
"assets/js/metisMenu.min.js",
"assets/js/jquery.slimscroll.min.js",
"assets/js/jquery.slicknav.min.js",
"assets/js/scripts.js",
"assets/js/vendor/modernizr-2.8.3.min.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "MDProject:build"
},
"configurations": {
"production": {
"browserTarget": "MDProject:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "MDProject:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"MDProject-e2e": {
"root": "e2e/",
"projectType": "application",
"targets": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "MDProject:serve"
},
"configurations": {
"production": {
"devServerTarget": "MDProject:serve:production"
}
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "MDProject"
}
让我知道我哪里出了问题。
答案 0 :(得分:0)
对资产使用“资产”键,对样式使用样式,对脚本使用脚本...
string ofilepath = @"E:\temp\Gst2-error.json";
OpenFileDialog fd = new OpenFileDialog();
fd.FileName = @"E:\temp\Gst2-error.json";
fd.Filter = "(*.json)|*.json";
if (fd.ShowDialog() == DialogResult.OK)
{
ofilepath = Path.ChangeExtension(fd.FileName, "xls");
}
else
{
MessageBox.Show("Json File Not Selected");
return;
}
if (!Directory.Exists(@"c:\gstreturns"))
{
Directory.CreateDirectory(@"c:\gstreturns");
}
using (FileStream s = File.Open(fd.FileName, FileMode.Open))
using (StreamReader sr = new StreamReader(s))
using (JsonReader reader = new JsonTextReader(sr))
{
JsonSerializer serializer = new JsonSerializer();
GSTR1 o;
while (reader.Read())
{
if (reader.TokenType == JsonToken.StartObject)
{
//dynamic jr = serializer.Deserialize<dynamic>(reader);
o = serializer.Deserialize<GSTR1>(reader);
string swFileName = @"c:\gstreturns\" + GetUniqueName("b2b.csv", @"c:\gstreturns\");
StreamWriter sw = new StreamWriter(swFileName, cbIsAppend.Checked);
string monthyear = new DateTime(2018,Convert.ToInt16(o.fp.Substring(0, 2)), 1).ToString("MMM", CultureInfo.InvariantCulture);
monthyear += " " + o.fp.Substring(2);
#region b2b
string s1 = monthyear +"," + o.gstin,
s2 = "", s3 = "", s4 = "";
if (o.b2b != null)
{
b2bcsv(o, swFileName, sw, s1, ref s2, ref s3, ref s4);
}
#endregion b2b
if (o.cdn != null)
{
cdncsv(o, out swFileName, out sw, monthyear, out s1, out s2, out s3, out s4);
}
if (o.cdnr != null)
{
cdnrcsv(o, out swFileName, out sw, monthyear, out s1, out s2, out s3, out s4);
}
}
}
}
更新:将“目标” 更改为“建筑师”
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.css",
"assets/css/font-awesome.min.css",
"assets/css/metisMenu.css",
"assets/css/typography.css",
"assets/css/default-css.css",
"assets/css/styles.css",
"assets/css/responsive.css"
],
"scripts": [
"assets/js/vendor/jquery-2.2.4.min.js",
"assets/js/metisMenu.min.js",
"assets/js/jquery.slimscroll.min.js",
"assets/js/jquery.slicknav.min.js",
"assets/js/scripts.js",
"assets/js/vendor/modernizr-2.8.3.min.js"
]