我有选择器日期的问题;
当我从选择器中选择日期并提交表单时...
在我的列表视图中,以这种格式显示的日期:
2019 年 11 月 3 日星期日 00:00:00 GMT-0700(太平洋夏令时)
如[屏幕截图][1]所示。
我想以这种格式显示日期:03/11/2019
我怎么办??
list-ech.page.html:
<ion-header>
</ion-header>
<ion-content>
<ion-grid>
<ion-row>
<ion-col size="12" size-sm="8" offset-sm="2">
<ion-list>
<ion-item-sliding *ngFor="let Echeancee of loadEcheances" #slidingItem="">
<ion-item [routerLink]="['/', 'list-echeances', Echeancee.id]" detail>
<ion-thumbnail item-start>
<ion-img [src]="Echeancee.chkImage"></ion-img>
</ion-thumbnail>
<h3>{{ Echeancee.BenefNamee }}</h3>
<p> {{ Echeancee.DateDuee }}</p>
</ion-item>
</ion-item-sliding>
</ion-list>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
Run Code Online (Sandbox Code Playgroud) 我读了一些关于减小角度项目大小的文章,在这些文章中我建立了一些解决方案,但其中之一对我来说是 Obscure 并且是 gzipped 压缩,我的问题是如何将 gzip 用于我的应用程序?
如果它对您有帮助,我将使用 asp.net core 作为我的后端技术。
我有一个利用SignalR与桌面应用程序进行通信的应用程序。要使用SignalR,我需要在.ts文件中使用jQuery。但是,从Angular 7迁移到Angular 8后,它似乎不起作用。
我declare var $: any;像以前的Angular版本一样使用。不幸的是,$现在在控制台上显示空白。
那么,Angular v8是否不再支持以这种方式使用jQuery,还是在迁移中出现了其他问题?
更新:
我有通过npm加载的jQuery v3.3.1。
这使其成为全局(在angular.json中)
"scripts": [
"./node_modules/jquery/dist/jquery.min.js",
"./node_modules/signalr/jquery.signalR.js"
]
Run Code Online (Sandbox Code Playgroud) 如何在app.module中添加formbulder
模块 AppModule 导入了意外值 FormBuilder。请添加@NgModule注释。
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule, HTTP_INTERCEPTORS } from "@angular/common/http";
import {FormBuilder, FormControl, FormGroup, Validators, FormsModule} from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ClientComponent } from './client/client.component';
import { ClientTaskComponent } from './clienttask/clienttask.component';
import { ClientService } from './client/sherad/client.service';
@NgModule({
declarations: [
AppComponent, ClientComponent, ClientTaskComponent, ClientService
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
FormsModule,
FormBuilder,
FormGroup,
FormControl
], …Run Code Online (Sandbox Code Playgroud) javascript single-page-application typescript ecmascript-6 angular
在角度教程中有以下示例:
<h3>
<a [title]="product.name + ' details'">
{{ product.name }}
</a>
</h3>
Run Code Online (Sandbox Code Playgroud)
如果我这样写的话,它会很棒:
<h3>
<a title="{{product.name + ' details'}}">
{{ product.name }}
</a>
</h3>
Run Code Online (Sandbox Code Playgroud)
有什么不同?最佳做法是什么?
我正在执行两个http请求,每个请求都返回a observable<IProduct>;,我想将两者都组合到一个本地对象中,并使用异步管道从每个请求中获取值。
productA$: observable<IProduct>;
productB$: observable<IProduct>;
combinedProds$: ?
this.productA$ = httpCall();
this.productB$ = httpCall();
this.combinedProds$ = combineLatest([
this.productA$,
this.productB$
])
.pipe(
map(([productA, productB]) =>
({ productA, productB}))
);
Run Code Online (Sandbox Code Playgroud)
我遇到的这个问题,我不知道combinedProds$应该是哪种类型。
在我的选择器中,我正在检查存储中的数据是否已加载并对应于路由器参数。路由器是“事实来源”,因此如果未加载数据,我想发送一个操作来获取它。在选择器中做这样的事情可以吗?
(currentGameState, router): Game => {
if (currentGameState.game.id === router.state.params.gameId &&
currentGameState.isLoaded) {
return currentGameState.game;
}
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 ngrx 并且有一个场景,我需要同时调度 2 个动作。我的状态具有用于更新和更新的属性,如下所示。
//from reducer
const defaultCardState: CardState = {
ids: [],
entities: {},
loaded: false,
loading: false,
adding: false,
added: false,
updating: false,
updated: false,
deleting: false,
deleted: false
};
Run Code Online (Sandbox Code Playgroud)
这些是我从我的组件分派的动作
this.store.dispatch(fromCard.updateCard({id: id1, changes: {name: name1}}))
this.store.dispatch(fromCard.updateCard({id: id2, changes: {name: name2}}))
Run Code Online (Sandbox Code Playgroud)
下面是我的动作,减速器和效果
//Update Card Actions
export const updateCard = createAction('[Cards] Update Card', props<{id: string, changes: any}>())
export const updateCardSuccess = createAction('[Cards] Update Card Success', props<{changes: any}>());
export const updateCardFail = createAction('[Cards] Update Card Fail')
//Reducer
on(fromCards.updateCard, (state) …Run Code Online (Sandbox Code Playgroud) 我知道已经有一个类似的问题,但它没有解决上述错误。
这是我在 API 控制器中的 PUT 操作,并且运行良好Swagger:
[HttpPut("{id}/upload")]
public async Task<IActionResult> UploadFile(string id, IFormFile file)
{
// codes using id above are omitted, nothing to do with the error
var path = Path.Combine(
Directory.GetCurrentDirectory(),
"wwwroot",
file.FileName
);
using (var stream = new FileStream(path, FileMode.Create))
{
await file.CopyToAsync(stream);
}
return Ok();
}
Run Code Online (Sandbox Code Playgroud)
以下是我的 Angular 网页中的代码:
超文本标记语言
<input type="file" (change)="setFile($event.target.files)"/>
<button (click)="save()"> Save </button>
Run Code Online (Sandbox Code Playgroud)
打字稿
forUpload: File = null;
@Input() someModel: SomeModel;
// setting of file
setFile(myFile: File){
if …Run Code Online (Sandbox Code Playgroud) 我仔细看了看,找不到这个问题的直接答案。
我添加的包devDependencies实际上最终会出现在生产包 JS 文件中并因此影响其大小吗?还是只有dependencies进入捆绑包的那个?
angular ×9
typescript ×8
javascript ×6
rxjs ×4
node.js ×3
angular8 ×2
asp.net-core ×2
c# ×2
ngrx ×2
redux ×2
.net-core ×1
ecmascript-6 ×1
npm ×1
webpack ×1