我故意将函数名称从toggleMenu()更改为toggleMen()。此新功能不存在。
<button (click)="toggleMen()"></button>
当我编译项目时(通过命令npm start),他不会向我显示任何错误或警告。他只是成功完成了编译。我希望他阻止我,并且在编译时失败,因为该函数不存在toggleMen()。
这是我的angular.json文件。
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"dist": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "build/dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"stylePreprocessorOptions": {
"includePaths": ["node_modules"]
},
"assets": [
"src/assets",
"src/favicon-96x96.png",
"src/app.config.json",
{
"glob": "**/*",
"input": "resources",
"output": "/resources"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "/assets/prebuilt-themes"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/bundles/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "/assets"
},
{
"glob": "pdf.worker.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
},
{
"glob": "pdf.worker.min.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
}
],
"styles": ["src/custom-style.scss"],
"scripts": [
"node_modules/pdfjs-dist/build/pdf.js",
"node_modules/pdfjs-dist/web/pdf_viewer.js",
"node_modules/raphael/raphael.min.js",
"node_modules/moment/min/moment.min.js"
]
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "dist:build",
"port": 4200,
"proxyConfig": "proxy.conf.js"
},
"configurations": {
"production": {
"browserTarget": "dist:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "dist:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"scripts": [
"node_modules/pdfjs-dist/build/pdf.js",
"node_modules/pdfjs-dist/web/pdf_viewer.js",
"node_modules/raphael/raphael.min.js",
"node_modules/moment/min/moment.min.js"
],
"styles": ["src/custom-style.scss"],
"assets": [
"src/assets",
"src/favicon-96x96.png",
"src/app.config.json",
{
"glob": "**/*",
"input": "resources",
"output": "/resources"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/prebuilt-themes",
"output": "/assets/prebuilt-themes"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-core/bundles/assets",
"output": "/assets"
},
{
"glob": "**/*",
"input": "node_modules/@alfresco/adf-content-services/bundles/assets",
"output": "/assets"
},
{
"glob": "pdf.worker.js",
"input": "node_modules/pdfjs-dist/build",
"output": "/"
}
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["tsconfig.app.json", "tsconfig.spec.json"],
"exclude": []
}
}
}
}
},
"defaultProject": "dist",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
这是我的tsconfig.json文件。
{
"compilerOptions": {
"allowJs": true,
"baseUrl": "src",
"jsx": "preserve",
"lib": ["es2018", "dom"],
"module": "ESNext",
"moduleResolution": "node",
"outDir": "build/tsc",
"sourceMap": true,
"target": "es5",
"typeRoots": ["node_modules/@types"],
"allowSyntheticDefaultImports": true,
"declaration": false,
"downlevelIteration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"importHelpers": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true
},
"exclude": [
"./build",
"./config",
"node_modules",
"**/*.spec.ts"
],
"include": [
"./src"
],
"angularCompilerOptions": {
"fullTemplateTypeCheck": true,
"strictInjectionParameters": true
}
}
这是我的package.json文件。
{
"name": "myProject",
"version": "1.0.0",
"blueprint": "Content Services",
"description": "ADF Application with Angular CLI",
"license": "LGPL-3.0",
"scripts": {
"ng": "ng",
"start": "tslint --project tsconfig.json && npm run validate-config && ng serve --open --port 4200",
"start-production": "tslint --project tsconfig.json && npm run validate-config && ng serve --configuration=production --open",
"compodoc": "npx compodoc -p tsconfig.app.json",
"build": "tslint --project tsconfig.json && ng build",
"build:prod": "tslint --project tsconfig.json && ng build --prod",
"postbuild:prod": "ts-node --skip-project config/postbuild.ts",
"test": "ng test",
"tslint": "tslint --project tsconfig.json --fix",
"prettier": "prettier --write \"**/*.ts\"",
"validate-config": "ajv validate -s node_modules/@alfresco/adf-core/app.config.schema.json -d ./src/app.config.json --errors=text --verbose",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@alfresco/adf-content-services": "3.6.0",
"@alfresco/adf-core": "3.6.0",
"@alfresco/adf-extensions": "3.6.0",
"@alfresco/adf-process-services": "3.6.0",
"@alfresco/js-api": "3.6.0",
"@angular/animations": "8.2.14",
"@angular/cdk": "8.2.3",
"@angular/common": "8.2.14",
"@angular/compiler": "8.2.14",
"@angular/core": "8.2.14",
"@angular/flex-layout": "8.0.0-beta.27",
"@angular/forms": "8.2.14",
"@angular/http": "7.2.16",
"@angular/material": "8.2.3",
"@angular/material-moment-adapter": "8.2.3",
"@angular/platform-browser": "8.2.14",
"@angular/platform-browser-dynamic": "8.2.14",
"@angular/router": "8.2.14",
"@ckeditor/ckeditor5-angular": "^1.1.2",
"@ckeditor/ckeditor5-build-classic": "^16.0.0",
"@mat-datetimepicker/core": "2.0.1",
"@mat-datetimepicker/moment": "2.0.1",
"@ngrx/effects": "8.6.0",
"@ngrx/router-store": "8.6.0",
"@ngrx/store": "8.6.0",
"@ngrx/store-devtools": "8.6.0",
"@ngx-translate/core": "11.0.1",
"ajv": "6.10.2",
"classlist.js": "1.1.20150312",
"custom-event-polyfill": "1.0.7",
"hammerjs": "2.0.8",
"minimatch-browser": "1.0.0",
"moment": "2.24.0",
"moment-es6": "1.0.0",
"ngrx-store-localstorage": "8.0.0",
"ngx-tinymce": "7.0.0",
"pdfjs-dist": "2.2.228",
"raphael": "2.3.0",
"rxjs": "6.5.4",
"systemjs": "6.1.9",
"xml-js": "1.6.11",
"zone.js": "0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.803.23",
"@angular-devkit/build-ng-packagr": "0.803.23",
"@angular/cli": "8.3.23",
"@angular/compiler-cli": "8.2.14",
"@compodoc/compodoc": "1.1.11",
"@types/hammerjs": "2.0.36",
"@types/jasmine": "3.5.0",
"@types/jasminewd2": "2.0.8",
"@types/node": "13.1.7",
"ajv-cli": "3.0.0",
"angular2-template-loader": "0.6.2",
"astrolabe": "0.3.6",
"autoprefixer": "9.7.4",
"bundlesize": "0.18.0",
"chalk": "3.0.0",
"codelyzer": "5.2.1",
"commander": "4.1.0",
"concurrently": "5.0.2",
"connect-history-api-fallback": "1.6.0",
"core-js": "3.6.4",
"ejs": "3.0.1",
"extract-text-webpack-plugin": "3.0.2",
"fs-extra": "8.1.0",
"http-proxy-middleware": "0.20.0",
"husky": "4.0.10",
"jasmine-ajax": "4.0.0",
"jasmine-core": "3.5.0",
"jasmine-reporters": "2.3.2",
"jasmine-spec-reporter": "4.2.1",
"jasmine2-protractor-utils": "1.3.0",
"js-yaml": "3.13.1",
"karma": "4.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-cli": "2.0.0",
"karma-coverage": "2.0.1",
"karma-coverage-istanbul-reporter": "2.1.1",
"karma-jasmine": "2.0.1",
"karma-jasmine-ajax": "0.1.13",
"karma-jasmine-html-reporter": "1.5.1",
"karma-mocha-reporter": "2.2.5",
"karma-remap-istanbul": "0.6.0",
"karma-systemjs": "0.16.0",
"license-checker": "25.0.1",
"lite-server": "2.5.4",
"markdown-toc": "1.2.0",
"markdownlint-cli": "0.21.0",
"mdast-util-compact": "2.0.0",
"mdast-util-heading-range": "2.1.3",
"mdast-util-toc": "5.0.1",
"mdast-zone": "3.0.4",
"merge-stream": "2.0.0",
"nconf": "0.10.0",
"ncp": "2.0.0",
"ng-packagr": "5.7.1",
"protractor": "5.4.2",
"protractor-html-reporter-2": "1.0.4",
"raw-loader": "4.0.0",
"remap-istanbul": "0.13.0",
"remark": "11.0.2",
"remark-frontmatter": "1.3.2",
"rimraf": "3.0.0",
"run-sequence": "2.2.1",
"rxjs-tslint-rules": "4.28.0",
"sass-loader": "7.1.0",
"scss-bundle": "3.0.2",
"stylelint": "12.0.1",
"systemjs-builder": "0.16.15",
"ts-node": "8.6.2",
"tsickle": "0.38.0",
"tslib": "1.10.0",
"tslint": "5.20.1",
"tslint-config-prettier": "1.18.0",
"typedoc": "0.16.6",
"typescript": "3.5.3",
"unist-util-select": "3.0.0",
"url-join": "4.0.1",
"webpack": "4.41.5",
"webpack-bundle-analyzer": "3.6.0",
"webpack-cli": "3.3.10",
"webpack-merge": "4.2.2"
},
"lint-staged": {
"*.{ts,js,css,scss,html}": [
"prettier --single-quote --write"
]
},
"pre-commit": "lint:staged"
}
您知道要更改/添加哪些内容以使编译器专注于有角度的HTML函数吗?
感谢您的阅读。我感谢每一个答案。祝你有美好的一天。