我有一个登录服务,执行http请求(到PHP后端服务器)并返回一个cookie.登录后,需要在客户端进行的所有进一步请求中使用此cookie.
login服务:
login(userCredentials:UserCredentials):Observable<any> {
this.request.ServiceType = "Connect"
this.request.SessionId = "sessionlessrequest"
this.request.Compression = "no"
this.request.Parameters = userCredentials;
let jsonRequest = JSON.stringify(this.request)
return this.http.post("http://localhost/request.php", "data="+ jsonRequest,
{ headers: new Headers({
'Content-Type': 'application/x-www-form-urlencoded'
})
}).map( (responseData) => {
this.apiResponse = responseData.json() as ApiResponse
if (!this.apiResponse.Error) {
this.sessionData.next(this.apiResponse.Data as UserSessionData)
this.sessionData.asObservable().share
} else {
console.log(this.apiResponse.ErrorMessage)
}
return null
})
Run Code Online (Sandbox Code Playgroud)
我看到我从session_start获取session_id(在我的php服务器上)
我在做请求的时候:
searchExams(searchObject:SearchObject):Observable<any>{
let headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded',)
let options = new RequestOptions({ headers: headers, withCredentials: true});
this.request.ServiceType = ServiceType.SearchExams;
this.request.SessionId = …Run Code Online (Sandbox Code Playgroud) 我正在努力实现以下目标:
我有一个服务A,这个服务包含一个rxjs行为主题:
public publishedList:BehaviorSubject<Data> = new BehaviorSubject<Data>(null)
getlist():Observable<Data> {
return this.http.post(......).map((responseData) => {
this.publishedList.next(responseData)
this.publishedList.asObservable().share
}
}
Run Code Online (Sandbox Code Playgroud)
组件A在构造函数中使用subscribe侦听此行为主题.
没问题.
现在组件B进入并放置一个按钮,该按钮应该能够清除或清空服务中的publishedList,并且应该更新组件A.
这可能吗?我该如何实现这一目标?
谢谢
想知道是否可以使用属性在列中格式化日期。例如:
<kendo-grid-column field="DOB" format="{0:d}" title="DOB" width="160" >
</kendo-grid-column>
Run Code Online (Sandbox Code Playgroud)
我想使用属性来格式化DOB。在我的TS文件中,我会有类似以下内容:
shortDate="dd/mm/yyyy"
Run Code Online (Sandbox Code Playgroud)
在HTML中:
<kendo-grid-column field="DOB" format="{0:shortDate}" title="DOB" width="160" >
</kendo-grid-column>
Run Code Online (Sandbox Code Playgroud)
这样的事情可能吗?
谢谢,
在这里打破我的头......我想用另一个数组过滤一个数组。
用例,我有一个数组,可以使用动态复选框过滤该数组。
到目前为止,我想出了以下代码:
var filteredList = this.arrayList.filter(function(e){
return activeCheckbuttons.filter(function(e2){
return e2.Description != e.Description
}).length == 0;
})
Run Code Online (Sandbox Code Playgroud)
上面的代码在只单击一个复选框时有效,但是当单击两个复选框时则不起作用。
有人吗?
谢谢,