我有一个宽度为100%的div.
我想把一个按钮放在其中,我该怎么做?
<div style="width:100%; height:100%; border: 1px solid">
<button type="button">hello</button>
</div>Run Code Online (Sandbox Code Playgroud) 我刚刚将 angular 更新为 latest 9.0.0-next.4。我没有使用路由,但在更新后突然我一直看到这个警告。如何删除此警告
WARNING in
src/war/angular/src/app/app-routing.module.ts是 TypeScript 编译的一部分,但未使用。仅将入口点添加到 tsconfig 中的“文件”或“包含”属性。
包.json
"dependencies": {
"@angular/animations": "^9.0.0-next.4",
"@angular/cdk": "^8.1.4",
"@angular/common": "^9.0.0-next.4",
"@angular/compiler": "^9.0.0-next.4",
"@angular/core": "^9.0.0-next.4",
"@angular/forms": "^9.0.0-next.4",
"@angular/material": "^8.1.4",
"@angular/platform-browser": "^9.0.0-next.4",
"@angular/platform-browser-dynamic": "^9.0.0-next.4",
"@angular/router": "^9.0.0-next.4",
"@ng-bootstrap/ng-bootstrap": "^5.1.0",
"bootstrap": "^4.3.1",
"hammerjs": "^2.0.8",
"moment": "^2.24.0",
"ng-image-slider": "^2.0.1",
"panzoom": "^8.1.2",
"rxjs": "~6.5.2",
"tslib": "^1.9.0",
"zone.js": "^0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.2",
"@angular/cli": "^8.3.2",
"@angular/compiler-cli": "^9.0.0-next.4",
"@angular/language-service": "^9.0.0-next.4",
"@types/jasmine": "~3.3.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "^5.0.0",
"jasmine-core": "~3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.1.0", …Run Code Online (Sandbox Code Playgroud) 将应用程序从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) 我试图在表格单元格中进行一个简单的输入按钮居中对齐.
我的标记是:
<table width="500" border="1">
<tr>
<td width="390">XXXXXXXXX</td>
<td width="110" rowspan="2" valign="middle"><input type="button" value="submit"></td>
</tr>
<tr>
<td>YYYYYYYY</td>
</tr>
</table>
<br /><br />
<div style="width:500px;">
<div style="float:left;width:390px;">
<div>XXXXXXX</div>
<div>YYYYYYY</div>
</div>
<div style="vertical-align:middle;width:110px;float:right;">
<div><input type="button" value="submit"></div>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
可以在这里查看:
我已经做了一个表格版本,显示了我想要实现的布局.请注意,由"XXXXX"或"YYYYYY"表示的文本具有可变长度.
这可能非常广泛,但让我缩小范围。假使,假设
我可以支持的最大宽度x高度是多少?
如果我尝试将27150x 20950图片放入<img>标签,Chrome 将会崩溃。
所以我想知道图像可以支持的最大宽度和高度。
注意:我已经过了这篇文章,但是它已经八岁了
编辑1:我能够加载160 Mb 4000x 4000px文件,因此文件大小不是问题,27150x 20950图像仅为7 Mb。压缩不是我的选择。
按照谷歌的人的评论点击这里
box-orient(及其webkit变体)是Flexbox规范的旧版本遗留的非标准属性。它的任何错误都可能与此有关。
所以在下面的代码中,我想删除以下样式 display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
并用新的flexbox规范替换它们,我该怎么做呢?想要的结果是像演示中那样将线夹在2行长度上(文本溢出到省略号)
<div style="min-height: 128px;
border-radius: 7px;
box-shadow: 0 2px 4px 0 rgba(210, 210, 210, 0.5);
border: solid 0.3px rgba(26, 25, 25, 0.15);
background-color: #ffffff;
width: 268px;
margin-bottom: 13px;">
<div style="overflow: hidden;
text-overflow: ellipsis;
padding-top: 5.6px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;">
Can we make this upper case? and also remove the word and’? Can we make this upper case? and also remove the word and’? Can we make this upper …Run Code Online (Sandbox Code Playgroud)我有一个嵌套的json对象。为了简单起见:
data = {'key1': 1, 'key2': 2, 'key3': {'nestedKey1': 3, 'nestedKey2': 4}}
Run Code Online (Sandbox Code Playgroud)
一个真实的对象更大,但要点是它是一个嵌套的对象。值可以是字符串,数字或其他对象。现在,我需要获取一个excel表(对于此特定的json如下所示):
|----------------------------------------
| key1 | key2 | key3 |
| | |--------------------------
| | | nestedKey1 | nestedKey2 |
|----------------------------------------
| 1 | 2 | 3 | 4 |
|----------------------------------------
Run Code Online (Sandbox Code Playgroud)
为了做到这一点,我尝试使用xlsx库。我导入库,如下所示:
import { WorkSheet, WorkBook, utils, writeFile } from 'xlsx';
Run Code Online (Sandbox Code Playgroud)
在我的方法中,我定义了对象:
let myObj = {'key1': 1, 'key2': 2, 'key3': {'nestedKey1': 3, 'nestedKey2': 4}}
Run Code Online (Sandbox Code Playgroud)
然后创建一个工作表和工作簿:
const workSheet: WorkSheet = utils.json_to_sheet([myObj]);
const workBook: WorkBook = utils.book_new();
utils.book_append_sheet(workBook, workSheet, 'object_to_save');
Run Code Online (Sandbox Code Playgroud)
最后将其写入文件: …
我在文档中没有发现任何关于字符限制的提及。似乎是一个非常普遍的要求。
如何向此 Textarea 添加 300 个字符的限制?
https://stackblitz.com/edit/angular-izbcey?file=app/input-overview-example.ts
我有一个具有引导下拉列表的组件,我想关注下拉范围内设置的当前周
我可以通过设置 ids 使用纯 javascript 来完成此操作,然后使用 Jquery .focus() 方法来关注它,但想知道是否有任何 Angular 7/ 7+ 方法可以使用 ViewChildren 等来完成此操作。
<button class="btn dropdown-toggle"
(click)="focusOnWeek(currentWeek)"
type="button" data-toggle="dropdown">
<span>Week {{currentWeek}}</span> // currentWeek = 5 need to focus on week 5 <a> tag on click of this span
</button>
<ul class="dropdown-menu">
<li *ngFor="let week of weekList">//weekList = [1,2,3,4,5,6,7,8,9,10]>
<a class="dropdown-item"
Week {{week}}
</a>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
单击按钮后,当前周将成为焦点。
预期输出应至少有 2 行高
\n\n\n\n我想保留text-overflow: ellipsis财产
<div style="min-height: 128px;\r\n border-radius: 7px;\r\n box-shadow: 0 2px 4px 0 rgba(210, 210, 210, 0.5);\r\n border: solid 0.3px rgba(26, 25, 25, 0.15);\r\n background-color: #ffffff;\r\n width: 268px;\r\n margin-bottom: 13px;">\r\n\r\n\r\n <div style=" width: 100px; font-family: Roboto;\r\n font-size: 13px;\r\n font-weight: normal;\r\n font-style: normal;\r\n font-stretch: normal;\r\n line-height: normal;\r\n letter-spacing: 0.29px;\r\n white-space: nowrap;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n padding-top: 5.6px;\r\n height: 49px;">\r\n Can we make this upper case? and also remove the word and\xe2\x80\x99? Can …Run Code Online (Sandbox Code Playgroud)angular ×6
css ×5
html ×5
javascript ×4
typescript ×2
angular-cli ×1
angular5 ×1
angular6 ×1
centering ×1
flexbox ×1
image ×1
layout ×1
mat-input ×1
migration ×1
sheetjs ×1
whitespace ×1
xlsx ×1