我已经好几周了,我正在寻找解决方案.我创建了(使用ng生成库)一个带有UI的库,用于在这里工作的新webproject ...实际上每个component
" template library
"都有这个ViewEncapsulation.None
集合...我知道这不是我们应该使用Angular的方式,但它会允许我们重复使用前几年所做的所有努力工作.
我希望将样式表"打包" (.css files)
成library
一种方式,当有人做" npm install templatelib
"他/她将自动包含在他们的应用程序中的所有样式和字体时,无需手动复制styles
和fonts
在他们的src/app
.
我希望以某种方式为我的用户提供一个原子单元,只需要template-lib-tag
在他们中设置一个app.component.html
并且它们都已设置好...然后他们只需要在模板设计中添加他们想要显示/使用的内容.content
components
我已经尝试了几乎所有我能找到的"打包"资产,但我要么得到错误说明了Data path "" should NOT have additional properties(styles)
.当我尝试添加资产或风格的angular.json ...或者它不会做什么我想它做导致的错误,它无法找到资产时NG服务.
我对Angular图书馆要求太高了吗?或者是一个充满了它的库components
,它们CSS
不是我可以plug
进入任何其他Angular应用程序的原子单元?
我做错了什么/误解,我们应该如何将资产"打包"到我们的图书馆,以便他们在安装软件包时一起旅行.
感谢您提前澄清.
我正在将我的应用程序升级到Angular 6.我正在从Angular 4升级,但下面的代码在Angular 6中导致错误,它在Angular 4中运行良好.
我得到的错误:
类型'typeof Observable'上不存在属性'of'
错误:类型'Observable'上不存在属性'catch'
我该如何解决这些错误?
private authInterceptor(observable: Observable<Response>): Observable<Response> {
return observable.catch((error, source) => {
if (error.status == 401) {
this.router.navigateByUrl('/login');
return Observable.of();
} else {
return Observable.throw(error);
}
});
}
Run Code Online (Sandbox Code Playgroud) 我无法从Angular 4中的Excel工作表中获取数据.下面是我的代码示例.
HTML代码:
<input id="my-file-selector" type="file" (change)="uploadData($event)" name="uploadExcel">
Run Code Online (Sandbox Code Playgroud)
upload.component.ts
:
public uploadData(event: any) : void {
// get data from file upload
let filesData = event.target.files;
console.log(filesData[0]);
}
Run Code Online (Sandbox Code Playgroud) 我在角度2/4中使用了表单构建器,但现在我在角度6中使用它.我已经看到了这个问题(不能绑定到'formGroup',因为它不是'form'的已知属性)但是它是针对角度2.我对角度4完全相同,但我得到了这个错误.请帮忙:我的代码是:
app.module.ts :(我已导出FormsModule和ReactiveFormsModule):
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { LocalStorage } from './services/localStorage.service';
import { HttpModule, RequestOptions, XHRBackend } from '@angular/http';
import { Router } from '@angular/router';
import { RouterModule } from '@angular/router';
import { AppComponent } from './app.component';
import { routing } from './app.route';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { LoginComponent } from './components/login/component';
import { ForgotComponent } from './components/forgotPassword/component';
@NgModule({
exports: [
FormsModule,
ReactiveFormsModule
], …
Run Code Online (Sandbox Code Playgroud) javascript angular-forms angular5 angular6 angular-formbuilder
我正在执行https://github.com/tensorflow/tensorflow这个检测图像中对象的示例.
我想得到检测到的对象的数量,下面是代码,它给出了我在图像中绘制的检测对象.但是我无法计算检测到的物体数量.
with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
# the array based representation of the image will be used later in order to prepare the
# result image with boxes and labels on it.
image_np = load_image_into_numpy_array(image)
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(image_np, axis=0)
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular …
Run Code Online (Sandbox Code Playgroud) 有没有人知道用百分比指示器实现Angular 2+预加载器的良好解决方案(类似于Gmail的加载屏幕)?
我知道通常的方法是添加<div>
内部我们的<app-root>
风格,甚至可以添加CSS动画,一旦应用程序加载,它将被应用程序内容替换.
但是......我实际看的是显示动画启动画面(SVG或其他任何内容),在动画完成后,应该出现加载栏并显示进度状态.
在第一点,我正在考虑单独的splash组件,它将只是组件急切加载并从那里加载所有其他模块但是如果我将该组件映射到'/'如何在任何其他路由上显示它作为第一个(起始点).此外,这意味着必须已加载Angular主包,因此这不是一个好的选择.
很可能这个问题太宽泛而且不适合Stack Overflow,但我找不到任何好的解决方案.:(
有没有办法加载没有Angular的纯JavaScript,它将加载Angular并显示进度?还是其他(更好)的想法?
这必须是可以实现的,因为整个Gmail都是Angular应用程序而且它们拥有它:D
我想使用缓存来加载JSP页面.我使用Java JSP Servlet创建了一个Dynamic Web Project.
在这个项目中,我从Rest API调用获取数据(以JSON格式),并将此数据动态地呈现在表内的JSP页面中.
我还在API数据中获取了具有数据时间的密钥名称"lastUpdate".
我第一次在表中呈现数据然后第二次调用Rest API后,我必须检查我的'lastUpdate'(在缓存中可用)时间是否与来自Rest API调用的'lastUpdate'相同然后我必须使用缓存显示相同的页面.
我不确定是否可能,我是缓存管理的新手.
所以请分享您的反馈和一些示例或教程,我可以参考.
我想在我的Angular2项目中使用Bootbox.我搜索了很多,但对我来说没有任何相关的解决方案.
我也试过,angular2-modal
但在使用时有很多问题angular2-modal
,请为此建议任何好的doc/Examples/Demos.
我刚刚使用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)
任何帮助都非常感谢,我的想法已经不多了.
我最近刚刚在我的Ubuntu 16.04计算机上安装了Angular,遵循此处的文档.但是当我生成一个新的Angular项目时,它会生成Angular 6.
我如何生成特定的角度4项目?
angular ×7
angular6 ×4
javascript ×4
angular-cli ×2
typescript ×2
angular5 ×1
bootbox ×1
caching ×1
java ×1
java-api ×1
jsp ×1
modal-dialog ×1
preloader ×1
python ×1
rxjs ×1
rxjs6 ×1
tensorflow ×1