npm -v 回报 6.0.0
node -v 回报 v10.0.0
Angular CLI本地和全局版本是 6.0.0
我创建了一个新的包ng new sample,运行npm install没有问题,然后我尝试ng update @angular/core或ng update @angular/cli得到401 Unauthorized回应.
尝试在已经安装的Angular 6存储库上运行更新似乎是多余的,但我对Angular 5存储库也有这个问题.
我没有太多可以从这个错误中继续下去,它是专门做的事情ng update还是更有可能是它之外的一些不相关的配置?
我讨厌所有的角度元素都是0x0像素,因为它们具有诸如app-card,app-accordion之类的名称,浏览器无法将其识别为符合HTML5的元素,因此不会提供任何默认样式。
这意味着在Chrome中检查它时,我看不到容器尺寸,并且当DOM真的很深时,很难理解哪个元素包含了屏幕上的哪个区域,等等。
在我看来,所有角度元素默认情况下都应进行块显示,这是合乎逻辑的,因为对于大多数情况而言,这是有道理的。
例如,考虑这些要素
bbs-accordion-header //(width 0px, height 0px)
Run Code Online (Sandbox Code Playgroud)
包含
bbs-accordion-header-regular //(width 1920px, height 153px)
Run Code Online (Sandbox Code Playgroud)
因此,bbs-accordion-header没有任何尺寸,即使它的孩子确实有它们。
我通过手动向每个元素.scss文件添加一行来解决此问题
:host { display: block; }
Run Code Online (Sandbox Code Playgroud)
但是每次手动添加它都是非常繁琐的。有谁知道更好的解决方案?
我在ngnix上部署了具有以下结构的角度dist文件夹.但得到Failed to decode downloaded font: host/rfid/fontawesome-webfont.af7ae505a9eed503f8b8.woff2?v=4.7.0; OTS parsing error: invalid version tag错误.
这是我如何包含字体 - 真棒.
的package.json
"dependencies": {
-------
"font-awesome": "^4.7.0",
--------
}
Run Code Online (Sandbox Code Playgroud)
angular.json
"styles": [
-----,
"node_modules/font-awesome/scss/font-awesome.scss",
-----
]
Run Code Online (Sandbox Code Playgroud)
这是我正在部署dist文件夹的路径.
/user/www/data/rfid/dist
Run Code Online (Sandbox Code Playgroud)
以下是我的nginx conf文件default.conf.
proxy_cache_path /tmp/nginx levels=1:2 keys_zone=nginx_cache_zone:10m inactive=60m;
proxy_cache_key "$scheme$request_method$host$request_uri";
client_max_body_size 20M;
proxy_read_timeout 600;
server {
listen 80 default_server;
server_name something;
location /rfid/ {
alias /user/www/data/rfid/dist/;
try_files $uri$args $uri$args/ /rfid/index.html;
}
}
Run Code Online (Sandbox Code Playgroud)
我还要包括我的构建内容.
我在这里错过了什么?提前致谢.
编辑:如果这是附加到要寻找的文件的URL查询字符串的问题,我还能当我只有指定的依赖并添加SASS文件吗?
我刚刚使用Angular 6创建了我的第一个Web组件.一切正常,直到我尝试将Web组件集成到现有应用程序中:
集成了Web组件的应用程序(https://www.example.com):
<script type="text/javascript" src="https://component.example.com/html-imports.min.js"></script>
<link rel="import" href="https://component.example.com/element.html">
<my-web-component uuid="2342-asdf-2342-ffsk"></my-web-component>
Run Code Online (Sandbox Code Playgroud)
我的Web组件index.html不包含base-href.
浏览器现在尝试加载Web组件的资源:
https://www.example.com/assets/i18n/de_CH.json
Run Code Online (Sandbox Code Playgroud)
代替
https://component.example.com/assets/i18n/de_CH.json
Run Code Online (Sandbox Code Playgroud)
当我尝试在构建期间添加base-href时,会导致:
ng build --configuration=development --base-href https://component.example.com/
Cannot read property 'startTag' of null
TypeError: Cannot read property 'startTag' of null
at IndexHtmlWebpackPlugin.<anonymous> (/home/www-data/.../node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin.js:147:62)
at Generator.next (<anonymous>)
at fulfilled (/home/www-data/.../node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/index-html-webpack-plugin.js:4:58)
Run Code Online (Sandbox Code Playgroud)
任何帮助都非常感谢,我的想法已经不多了.
我们在CI管道中观察了随机业力测试.在每次运行中,不同的测试失败,有时它会通过,当它失败时会抛出此错误:
Uncaught TypeError: params.map is not a function thrown
有没有人受到类似的影响?
我必须访问技能路线,这对我来说是不可能的.我已经尝试了很多方法,但是我无法按照代码结构访问技能路线.我的想法是能够访问仪表板模块的子路径
非常感谢你提前.
// app.routing.module.ts
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
// components for route controller
import { HomeComponent } from './components/home/home.component';
const routes: Routes = [
{
path: '', redirectTo: 'home', pathMatch: 'full'
},
{
path: 'home', component: HomeComponent
},
{
path: 'dashboard',
loadChildren: '../app/modules/dashboard/dashboard.module#DashboardModule'
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
Run Code Online (Sandbox Code Playgroud)
....
// dashboard.routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from …Run Code Online (Sandbox Code Playgroud) 我正在学习Angular 6.
我以层次结构形式设计了我的应用程序结构,结构如下.
my_app
|- src
|- app
|- layout
|- admin-layout
|- admin-layout.module.ts
|- admin-layout.routing.ts
|- admin-layout.component.html
|- contacts
|- contact-list
|- contact-list.component.ts
|- contact-list.component.html
|- contacts.module.ts
|- transaction
|- amount-given
|- amount-given-list
|- amount-given-list.component.ts
|- amount-given-list.component.html
|- amount-given.module.ts
|- amount-given.routing.ts
|- amount-given.service.ts
|- transaction.module.ts
|- transaction.routing.ts
|- app.module.ts
|- app.component.html
|- app-routing.module.ts
Run Code Online (Sandbox Code Playgroud)
源代码和演示图可以在这里找到:https: //stackblitz.com/edit/angular-wcglvr
<a routerLink="/dashboard">Dashboard</a>
Run Code Online (Sandbox Code Playgroud)
是工作,/transaction/amount-given/amount-given-list/但不是从/contacts/contact-list.
由于源代码很长且层次分明,我在stackblitz上添加了演示插图.
我正在尝试添加角形材质组件。但该组件无法正常工作。该错误说
Uncaught Error: Template parse errors: 'mat-option' is not a known element:
// ...
Run Code Online (Sandbox Code Playgroud)
我认为错误来自app.module.ts:
Uncaught Error: Template parse errors: 'mat-option' is not a known element:
// ...
Run Code Online (Sandbox Code Playgroud) 在我的应用程序中,我在ng2-smart-table的下拉列表中加载了动态值.现在我必须在ng2-smart-table中的下拉列表中启用多个选择.
注意:下拉列表中的多项选择不是复选框.
我们正在根据用户角色维护会话。我们想在会话空闲5分钟时实现超时功能。我们正在使用@ ng-idle / core npm模块来做到这一点。
我的服务文件:
import { ActivatedRouteSnapshot } from '@angular/router';
import { RouterStateSnapshot } from '@angular/router';
import {Idle, DEFAULT_INTERRUPTSOURCES, EventTargetInterruptSource} from
'@ng-idle/core';
@Injectable()
export class LoginActService implements CanActivate {
constructor(private authService: APILogService, private router:
Router,private idle: Idle) {
idle.setIdle(10);
idle.setTimeout(10);
}
canActivate(
next: ActivatedRouteSnapshot,
state: RouterStateSnapshot
): Observable<boolean>|Promise<boolean>|boolean {
let role = localStorage.getItem('currentUser');
if (localStorage.getItem('currentUser')) {
if(next.data[0] == role){
},600000)
return true;
}
}
else{
this.router.navigate(['/'], { queryParams: { returnUrl: state.url }});
return false;
}
}
}
Run Code Online (Sandbox Code Playgroud)
作为示例,我使用了setIdle超时5秒钟,但这没有发生。有人可以指导我该怎么做吗?
angular6 ×10
angular ×8
angular-cli ×2
angular5 ×1
angular7 ×1
lazy-loading ×1
nginx ×1
routing ×1
session ×1
typescript ×1