我正在尝试创建Angular 5 Web应用程序,但是我的老板不希望我使用Node.js / npm。而是要我使用Java,这有可能吗?
在我完成的所有阅读/研究中,每个人都使用Node.js / npm“甚至是Angular网站”。那么,如何使用Java而不是Node.js / npm创建应用程序?
如果Angular 5不需要Node.js / npm,为什么会有这么多人使用它?它不会破坏他们的代码库吗?另外,如何使用Java替换Node.js / npm?我是否应该知道在没有Node.js / npm的情况下支持Java / Angular 5应用程序的其他工具/语言?
如果Node.js的/ NPM 是需要角5,为什么呢?它对Java无法完成的Angular 5框架有什么作用?
如果有人举一个使用Java而不是Node.js / npm的Angular 5 Web应用程序的示例,我将不胜感激。
当我得到警告时:
“警告:清理HTML会剥离一些内容”
我进行了一些研究,发现人们使用下面的管道或看起来像下面的管道
import { Pipe, PipeTransform } from "@angular/core";
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Pipe({
name: 'sanitizeHtml'
})
export class SanitizeHtmlPipe implements PipeTransform {
constructor(private _sanitizer:DomSanitizer) { }
transform(v:string):SafeHtml {
return this._sanitizer.bypassSecurityTrustHtml(v);
}
}
Run Code Online (Sandbox Code Playgroud)
不幸的是,即使我实现这样的管道,我仍然会遇到相同的错误:
<span [innerHTML]="specialist.blocks[0].paragraph.html | sanitizeHtml"></span>
<p [innerHTML]="package.fields.remarks | sanitizeHtml"></p>
<li [innerHTML]="package.fields.name | sanitizeHtml"></li>
Run Code Online (Sandbox Code Playgroud)
所以我想知道我是错误地实现了管道还是还有其他原因导致管道不起作用?
编辑:
的示例specialist.blocks[0].paragraph.html:
“ <div id =” test“ class =” test“> \ n <h3> NAME专家名单</ h3> \ n <p>随机文本</ p> </ div> \ n </ div>”
的示例package.fields.remarks …
我正在尝试使用最新的角度cli来生成组件.我试图生成一个模块也有类似的错误.
ng g component testComponent
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误
input.mergeMap is not a function
TypeError: input.mergeMap is not a function
at Object.callRule (C:\Users\dammy\Documents\Visual Studio 2017\Projects\Cars\node_modules\@angular-devkit\schematics\src\rules\call.js:70:18)
Run Code Online (Sandbox Code Playgroud)
我的Package.json文件如下所示:
{
...
},
"dependencies": {
...
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"html-loader": "0.4.5",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"preboot": "4.5.2",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "5.5.5",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"typescript": "2.4.1",
"url-loader": "0.5.9",
"webpack": "2.5.1",
"webpack-hot-middleware": "2.18.2",
"webpack-merge": "4.1.0",
"zone.js": "0.8.12"
},
Run Code Online (Sandbox Code Playgroud)
我安装了:Angular/cli@1.6.0
我的应用程序文件夹结构如下:
>app
app.module.ts
app.routing.ts
>>auth
login.component
auth.module.ts
atuh.routing.module.ts
Run Code Online (Sandbox Code Playgroud)
现在,我想使用ngx-intl-input依赖于的模块ngx-bootstrap。我想包括intl-input在登录组件中。
所以,如果我进口ngx-bootsrap的auth.module...
auth.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LoginComponent } from './login/login.component';
import { AuthRoutingModule } from './auth-routing.module';
import { BsDropdownModule } from 'ngx-bootstrap/dropdown';
import { NgxIntlTelInputModule } from 'ngx-intl-tel-input';
@NgModule({
imports: [
CommonModule,
AuthRoutingModule,
BsDropdownModule.forRoot(),
NgxIntlTelInputModule
],
declarations: [LoginComponent]
})
export class AuthModule { }
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
ERROR Error: Uncaught (in promise): Error: …Run Code Online (Sandbox Code Playgroud) 对于Angular 5的某些方面,我有些不确定。我已经开发了一个应用程序,但不知道如何在生产环境中运行它。
目前我使用运行我的应用程序ng serve中NodeJS,但它是在生产环境中一样吗?
谢谢!
我很抱歉模糊,但我真的不知道该提到什么,除了我收到这个错误!我不知道为什么除了我认为它与兼容版本有关.一切都在一台机器上运行.我把它克隆到另一个并且现在有这个错误.
我正在使用angularfire2运行Angular 5.
请告诉我哪些日志等会有所帮助.
谢谢,韦恩
我也在使用ngx-pwa-localStorage所以它可能有一些东西: Chrome控制台错误:请求的版本(1)小于现有版本(2)
下面是我的package.json
{
"name": "scriptertainment",
"version": "0.4.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/core": "^0.4.6",
"@angular-devkit/schematics": "0.0.52",
"@angular/animations": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.2.10",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"@angular/service-worker": "^5.2.10",
"@ng-bootstrap/ng-bootstrap": "^1.1.0",
"@ngx-pwa/local-storage": "^5.2.0",
"angularfire2": "5.0.0-rc.6",
"bootstrap": "4.0.0-beta.2",
"core-js": "^2.4.1",
"firebase": "^4.12.0",
"ionicons": "^3.0.0",
"ngx-filter-pipe": "2.1.0",
"ngx-swiper-wrapper": …Run Code Online (Sandbox Code Playgroud) firebase angularfire2 angular google-cloud-firestore angular5
我目前在这个问题上花了一天时间,仍然无法从角度5的网址下载文件
leadGenSubmit() {
return this.http.get('http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf',
{responseType:ResponseContentType.Blob}).subscribe((data)=>{
console.log(data);
var blob = new Blob([data], {type: 'application/pdf'});
console.log(blob);
saveAs(blob, "testData.pdf");
},
err=>{
console.log(err);
}
)
}
Run Code Online (Sandbox Code Playgroud)
当我运行上面的代码时,它显示以下错误
ERROR TypeError: req.responseType.toLowerCase is not a function
at Observable.eval [as _subscribe] (http.js:2187)
at Observable._trySubscribe (Observable.js:172)
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题.任何人都可以发布正确的代码从角度5的网址下载pdf文件?
我正在尝试做与这篇文章完全相同的事情:Angular 4 get queryString
我正在使用Angular 5.2.5。
当用户首次访问网站时,ActivatedRoute似乎是用来从URL检索查询字符串值的东西。但是,我无法弄清楚需要导入什么才能使用ActivatedRoute。
有人可以确切指定需要添加到app.module.ts文件以及我要使用ActivatedRoute的component.ts文件的内容吗?
这篇文章指定将路由添加到@NgModule的imports数组:ActivatedRoute-Angular 2 RC5的没有提供程序。但是,我没有app.routing.ts文件。我必须创建一个app.routing.ts文件才能使用ActivatedRoute吗?
我已经在ng update @angular/cli命令的帮助下更新了我的angular-cli .之后,我遇到了Could not determine single project for 'server' target错误跟踪错误.
Could not determine a single project for the 'serve' target.
Error: Could not determine a single project for the 'serve' target.
at ServeCommand.getProjectNamesByTarget (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:175:19)
at ServeCommand.<anonymous> (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:128:51)
at Generator.next (<anonymous>)
at E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:7:71
at new Promise (<anonymous>)
at __awaiter (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:3:12)
at ServeCommand.runArchitectTarget (E:\Angular\Projects\projectName\node_modules\@angular\cli\models\architect-command.js:121:16)
at ServeCommand.<anonymous> (E:\Angular\Projects\projectName\node_modules\@angular\cli\commands\serve.js:34:25)
at Generator.next (<anonymous>)
at E:\Angular\Projects\projectName\node_modules\@angular\cli\commands\serve.js:7:71
Run Code Online (Sandbox Code Playgroud)
这种行为让我很困惑.有关更多信息,我也在package.json这里添加.
{
"name": "ProjectName",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": …Run Code Online (Sandbox Code Playgroud) 我将这些动态组件声明为模块中的入口组件,我也想在其中呈现它们.使用JIT它可以正常工作.以下结构有我的应用程序的一部分,我想渲染它们:app -> home (lazy) -> contracts (lazy) -> search.
所以我将这些组件添加到我用于的模块中search component/route.当我使用AOT进行编译时,每次访问搜索路径时,该应用程序都会告诉我没有组件工厂.当然我搜索谷歌并找到了一些结果:
我尝试将它们添加到ANALYZE_FOR_ENTRY_COMPONENTS提供程序中,我尝试.forRoot()在我的app.module中导入ModuleWithProviders,我也尝试在根模块(app.module)中导入和声明我的动态及其所有依赖组件.一切都导致了同样的错误.
我声明我的动态组件作为入口组件,如:所以
Run Code Online (Sandbox Code Playgroud)
@NgModule({
imports: [SharedComponentsModule, FinoSchemaFormsModule, TabGroupModule, FinoInputModule],
declarations: [EnergySearchSettingsComponent, DslSearchSettingsComponent, MobileSearchSettingsComponent, ComparisonDetailSectionComponent],
entryComponents: [EnergySearchSettingsComponent, DslSearchSettingsComponent, MobileSearchSettingsComponent],
exports: [EnergySearchSettingsComponent, DslSearchSettingsComponent, MobileSearchSettingsComponent, ComparisonDetailSectionComponent],
providers: [CategoryMappingProvider]
})
export class ComparisonComponentsModule { }
This module gets imported in the SearchModule我SearchComponent的声明.在这个组件中,我想使用ComponentFactoryResolverI注入动态渲染这些组件SearchComponent.
ngOnInit() {
this.searchSettingsComponent = this.comparisonService.getSearchComponent(); // returns either EnergySearchSettingsComponent, DslSearchSettingsComponent or MobileSearchSettingsComponent
let componentFactory = this.componentFactoryResolver.resolveComponentFactory(searchSettingsComponent); …Run Code Online (Sandbox Code Playgroud) angular5 ×10
angular ×8
angular-cli ×2
node.js ×2
angular6 ×1
angularfire2 ×1
firebase ×1
java ×1
javascript ×1
lazy-loading ×1
ng-bootstrap ×1
npm ×1
query-string ×1