将应用程序从5号角迁移到6号角后,运行ng时会弹出以下错误。
模式验证失败,并出现以下错误:数据路径“”不应具有其他属性(项目)。错误:模式验证失败,并出现以下错误:数据路径“”不应具有其他属性(项目)。在MergeMapSubscriber._registry.compile.pipe.operators_1.concatMap.validatorResult [作为项目](... / TemplateApp / me-cmf-web-template-angular / node_modules / @ angular-devkit / core / src / workspace / workspace中。 js:210:42)在MergeMapSubscriber._tryNext(/.../me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/mergeMap.js:65:27 )(位于MergeMapSubscriber.Subscriber._next(... / me-cmf-web-template-angular/node_modules/@angular-devkit/core/node_modules/rxjs/internal/operators/mergeMap.js:55:18)中。
我假设错误与.angular.json文件有关,该文件是从.angular-cli.json重命名的。
我的.angular.json文件如下:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "mediaweb"
},
"apps": [{
"root": "src",
"outDir": "dist/browser",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.scss",
"../node_modules/owl.carousel/dist/assets/owl.carousel.css",
"../node_modules/owl.carousel/dist/assets/owl.theme.default.css",
"../node_modules/video.js/dist/video-js.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.js",
"../node_modules/owl.carousel/dist/owl.carousel.js",
"../node_modules/video.js/dist/ie8/videojs-ie8.js",
"../node_modules/video.js/dist/video.js"
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.dev.ts",
"prod": …Run Code Online (Sandbox Code Playgroud) 从Angular 5迁移到6之后,我遇到了静态注入器的问题.错误是:
错误错误:StaticInjectorError(AppModule)[StorageService - > LocalStorageService]:StaticInjectorError(Platform:core)[StorageService - > LocalStorageService]:NullInjectorError:没有LocalStorageService的提供者!atInullInjector.push ../ node_modules/@angular/core/fesm5/core.js.NullInjector.get(core.js:1062)at resolveToken(core.js:1300)at tryResolveToken(core.js:1244)at StaticInjector在StaticInjector.push的tryResolveToken(core.js:1244)的resolveToken(core.js:1300)处的.push ../ node_modules/@angular/core/fesm5/core.js.StaticInjector.get(core.js:1141)位于_createClass(core.js:8423)的resolveNgModuleDep(core.js:8376)位于_createProviderInstance(core.js)的../node_modules/@angular/core/fesm5/core.js.StaticInjector.get(core.js:1141) :8393)在_createClass(core.js:8423)处的resolveNgModuleDep(core.js:8356)atAndModuleRef.的breakNgModuleDep(core.js:8356)处的createProviderInstance(core.js:8393) .push ../ node_modules/@ angular atcore /fesm5/core.js.NgModuleRef_.get(core.js:9064)at resolveDep(core.js:9429)at createClass(core.js:9309)at createDirectiveInstance(core.js:9186)at createViewNodes(core .js:10406)在object.de上的callWithDebugContext(core.js:11351)的createRootView(core.js:10320)在ComponentFactoryBoundToModule.push ../ node_modules的ComponentFactory_.push ../ node_modules/@angular/core/fesm5/core.js.ComponentFactory_.create(core.js:8666)的bugCreateRootView [as createRootView](core.js:10838) /@angular/core/fesm5/core.js.ComponentFactoryBoundToModule.create(core.js:3315)at ApplicationRef.push ../ node_modules/@angular/core/fesm5/core.js.ApplicationRef.bootstrap(core.js: 4550)at core.js:4358 at ArrayRef.push ../ node_modules/@angular/core/fesm5/core.js.PlatformRef._moduleDoBootstrap(core.js:4358)at core.js:4324位于ZoneDelegate.push ../ node_modules/zone的Object.onInvoke(core.js:3824)上的ZoneDelegate.push ../ node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke(zone.js:388)区域中的.js/dist/zone.js.ZoneDelegate.invoke(zone.js:387)位于Zone.push ../ node_modules/zone.js/dist/zone.js.Zone.run(zone.js:138) .js:872 at ZoneDelegate.push ../ node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask(zone.js:421)at Object.onInvokeTask(core.js:3815)a 在Zone.push ../ node_modules/zone.js/dist/zone.js.Zone中的ZoneDelegate.push ../ node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask(zone.js:420). runTask(zone.js:188)
import { InfiniteScrollModule } from 'ngx-infinite-scroll';
import { AuthModule } from './auth/auth.module';
import { ConfigurationModule } …Run Code Online (Sandbox Code Playgroud)我创建了一个画布,并使用 JavaScript 在画布内创建了一个圆圈。我曾经stroke()给圆圈一个边框,但我不知道如何增加边框的宽度。我以为我可以使用strokeWidth(),但我不确定。
var c=document.getElementById('canvas');
var ctx=c.getContext('2d');
ctx.beginPath();
ctx.fillStyle="blue";
ctx.arc(150,73,70,0,2*Math.PI);
ctx.fill();
ctx.strokeStyle="yellow";
ctx.stroke();
ctx.closePath();Run Code Online (Sandbox Code Playgroud)
#canvas{
height: 250px;
width: 500px;
background-color: orange;
border: 1px solid black;
margin-left: auto;
margin-right: auto;
left: 0;
right: 0;
display:block;
}Run Code Online (Sandbox Code Playgroud)
<canvas id="canvas" width=500 height=250></canvas>Run Code Online (Sandbox Code Playgroud)
我试图在服务器端运行我的Angular应用程序,并且遇到以下错误:
npm ERR!缺少脚本:build:universal
npm ERR!可以在以下位置找到该运行的完整日志:npm ERR!
/home/training/.npm/_logs/2018-10-03T11_50_40_593Z-debug.log
我使用了官方的Angular应用程序来执行此操作
https://angular.io/guide/universal
通用版本引起如下所示的错误:
0信息,如果它以ok结尾就可以正常工作1详细cli ['/ usr / bin / nodejs',1详细cli'/ usr / local / bin / npm',1详细cli'run',1详细cli'build:universal '] 2使用npm@6.2.0的信息3使用node@v10.8.0的信息4详细堆栈错误:缺少脚本:build:运行时通用4详细堆栈(/ usr / local / lib / node_modules / npm / lib / run- script.js:155:19)4个详细堆栈位于/usr/local/lib/node_modules/npm/lib/run-script.js:63:5 4个详细堆栈位于/ usr / local / lib / node_modules / npm / node_modules /read-package-json/read-json.js:115:5 4详细堆栈位于/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:418:5 4详细堆栈在checkBinReferences_(/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:373:45)最后的4个详细堆栈(/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:416:3)当时的4个详细堆栈(/ usr / local / lib / node_modules / npm / node_modules / read-package-json / read-json.js:160:5)位于/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js的4个详细堆栈:280:12 /usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js中的4个详细堆栈:78:16 FSReqWrap.readFileAfterClose处的4个详细堆栈[不完整](内部/ fs / read_file_context.js:53:3)5冗长的cwd / home / training / …
我正在尝试在角度应用程序中单击按钮时显示模态。我安装了引导程序并编写了引导程序教程中指定的代码。该模式在检查浏览器的 html 期间可用,但不会显示在浏览器上,因此单击时可用。但是,将模态元素显示属性从块更改为内容会显示模态。请在下面找到当前的代码。
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
模式显示在普通的 html 和 css 中,而不是在 angular 中
我的页面中有很长的文字.我希望我的页脚粘在底部,文本应该隐藏在页脚下面,这样我就可以滚动文本了.页脚下不应有任何文字.我怎样才能做到这一点?
.container {}
footer {
position: absolute;
bottom: 0;
}Run Code Online (Sandbox Code Playgroud)
<html>
<div class="container">
<p>Long long text</p>
<footer>My footer</footer>
</div>
</html>Run Code Online (Sandbox Code Playgroud)
angular ×4
css ×3
html ×3
angular5 ×2
angular6 ×2
javascript ×2
typescript ×2
migration ×1
node.js ×1
npm ×1