本文整理汇总了TypeScript中ng2-redux.NgRedux.getState方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NgRedux.getState方法的具体用法?TypeScript NgRedux.getState怎么用?TypeScript NgRedux.getState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ng2-redux.NgRedux
的用法示例。
在下文中一共展示了NgRedux.getState方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: updateQueryParams
updateQueryParams() {
this.router.navigate(['search'], {
queryParams: {
term: this.ngRedux.getState().search.get('term'),
page: this.ngRedux.getState().search.get('page'),
}
});
}
示例2: getID
getID() {
let currState = this.ngRedux.getState();
if (currState.login.userData !== null) {
return currState.login['userData'].authid;
}
return undefined;
}
示例3: extractUser
extractUser(res: Response): IUser{
let user = res.json().data;
let state = this.store.getState();
let url = state.lastVisitedUrl;
this.store.dispatch(updateUser(user));
this.router.navigate([url]);
return user;
}
示例4: options
private get options() {
const state = this.ngRedux.getState();
const token = state == null || state.session == null
? null
: state.session.get('token');
const headers = new Headers({
'Content-Type': 'application/json',
'Authentication-Token': token
});
return { headers };
}
示例5: acceptSession
acceptSession(session) {
const teacherID = this.ngRedux.getState().login.userData.authid;
const studentID = session.studentauthid;
this.socket.acceptSession(teacherID, studentID);
}
示例6: hasPendingRequest
hasPendingRequest(teacher) {
const teachers = this.ngRedux.getState().sessionRequest.requests
.map(request => request.teacherauthid);
return teachers.indexOf(teacher.authid) > -1;
}
示例7: increment
increment() {
this.ngRedux.dispatch({type:'INCREMENT'});
this.counter = this.ngRedux.getState().counter;
}
示例8:
ngRedux.subscribe(() => {
let state = ngRedux.getState();
console.log(state);
})
示例9: incrementIfOdd
incrementIfOdd() {
const { counter } = this.redux.getState();
if (counter % 2 === 0) return;
this.redux.dispatch({ type: INCREMENT_COUNTER });
}
示例10: getLastVisitedUrl
getLastVisitedUrl(){
let state = this.store.getState();
return state.lastVisitedUrl;
}