我更新了我的angular-cli然后我在ng服务中出错了
Callback was already called.
at throwError (node_modules\neo-async\async.js:14:11)
at node_modules\neo-async\async.js:2805:7
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
Run Code Online (Sandbox Code Playgroud)
这是我的项目包的版本:
Angular CLI: 6.0.7
Node: 8.9.4
OS: win32 x64
Angular: 5.0.1
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.7
@angular-devkit/build-angular 0.6.7
@angular-devkit/build-optimizer 0.6.7
@angular-devkit/core 0.6.7
@angular-devkit/schematics 0.6.7
@angular/cdk 5.2.4
@angular/cli 6.0.7
@angular/material 5.2.4
@angular/platform-server 5.1.1
@ngtools/webpack 6.0.7
@schematics/angular 0.6.7
@schematics/update 0.6.7
rxjs 5.5.2
typescript 2.4.2
webpack 4.4.1
Run Code Online (Sandbox Code Playgroud)
我试图删除节点模块然后重新安装但仍然有相同的错误...任何建议?
如何将“ [对象对象]”(日期选择器)转换为日期格式
<input type="text"
id="date"
class="form-control"
formControlName="date"
name="date"
[(ngModel)]="date"
ngbDatepicker
#incorporatedDatePicker="ngbDatepicker"
(click)="incorporatedDatePicker.toggle()"
readonly>
Run Code Online (Sandbox Code Playgroud)
当我展示
{{meeting.date | date }}
Run Code Online (Sandbox Code Playgroud)
我有错误:管道'DatePipe'的invalidPipeArgument错误'[object Object]'
我必须获取当前用户 ID 才能在我的应用程序的不同部分使用它。
登录.component.ts:
onSignin(form: NgForm){
const UserName = form.value.UserName;
const Password = form.value.Password;
this.authService.signinUser(UserName,Password).map(res => res.json())
.subscribe(
data => {
if (data.Id == 0){
this.invalid=true;
}
else{
localStorage.setItem('isLoggedin', 'true');
this.router.navigate(['/calendar']);
console.log('Ok');
}})}
Run Code Online (Sandbox Code Playgroud)
auth.service.ts:
signinUser(UserName,Password): Observable<any>{
return this.http.get('http://api.##.com/api/security/signin?username='+UserName+'&password='+Password);
}
Run Code Online (Sandbox Code Playgroud) 当我将日期发送到 API 时,如何使用打字稿以特定格式 (DateTime) 将当前日期发送到 API,它以这种格式发送,所以我收到了错误。
我的 ts 代码:
date: Date;
constructor( private dataStorageService: DataStorageService) {
this.date = new Date();
}
onSubmit(Message , form : FormGroup){
let newMsg = {
username: Message.username,
header: Message.header,
content: Message.content,
file: Message.file
}
this.dataStorageService.postMessage(newMsg, this.Id , this.date).subscribe(data => {
console.log('done');
console.log(this.date);
}, error => {
console.error("Error saving jobs!");
})
}
Run Code Online (Sandbox Code Playgroud)
http://api.azharcouncil.com/api/notification/PostNotification?user_id=15&Header=hj&Content=hjh&File_Path=null& date=Wed%20Nov%2015%202017%2010:44:56%20GMT+0200%20(和埃及%20 %20 时间)
所以我的请求由于日期格式而无效...
angular ×3
typescript ×3
angular-cli ×2
date ×2
angular5 ×1
datepicker ×1
datetime ×1
userid ×1
webpack ×1