本文整理匯總了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;
}