當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript NgRedux.select方法代碼示例

本文整理匯總了TypeScript中ng2-redux.NgRedux.select方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript NgRedux.select方法的具體用法?TypeScript NgRedux.select怎麽用?TypeScript NgRedux.select使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ng2-redux.NgRedux的用法示例。


在下文中一共展示了NgRedux.select方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor(
     ngRedux: NgRedux<IAppState>,
     bankService: BankService // instantiating service because its not by bootstrap()!
 ) {
     this.pot$ = ngRedux.select(n => n.bank.get('pot'));
     this.bank$ = ngRedux.select(n => n.bank.get('bank'));
 }
開發者ID:asiam9,項目名稱:angularattack2016-dices-game,代碼行數:7,代碼來源:bank.ts

示例2: ngOnInit

    ngOnInit() {
        this.needMapSubscription = this.ngRedux
            .select<any>(state => state.needMap)
            .subscribe(needMap => {
                // console.log('PeoplePanel.needMap', needMap);
                this.needMap = needMap;
            });

        this.personMapSubscription = this.ngRedux
            .select<any>(state => state.personMap)
            .subscribe(personMap => {
                // console.log('PeoplePanel.personMap', personMap);
                this.personMap = personMap;
            });

        this.matchedPeopleSubscription = this.ngRedux
            .select<number[]>(state => state.matchedPeople)
            .subscribe(matchedPeople => {
                // console.log('PeoplePanel.matchedPeople', matchedPeople);
                this.matchedPeople = matchedPeople;
            });

        this.selectedNeedSubscription = this.ngRedux
            .select<number>(state => state.selectedNeedId)
            .subscribe(selectedNeedId => {
                // console.log('PeoplePanel.selectedNeedId', selectedNeedId);
                this.selectedNeedId = selectedNeedId;
                this.handleNeedSelected(selectedNeedId);
            });
    }
開發者ID:jbhg,項目名稱:staffer,代碼行數:30,代碼來源:people-panel.component.ts

示例3: ngOnInit

  ngOnInit(): void {

    this.ngRedux
      .select(state => state.core.message)
      .subscribe(message => this.message = message);

    this.ngRedux
      .select(state => state.core.errors)
      .subscribe(errors => this.errors = errors);
  }
開發者ID:echo-anna,項目名稱:SoftUni,代碼行數:10,代碼來源:message.handler.component.ts

示例4: activityConnector

  activityConnector() {
    this.activities$ = this.ngRedux.select(['eventData', 'items'])
    .map((activity:Map<string, any>) => {
      var b = activity.filter((activity:Map<string, any>) => {
        return this.shouldInclude(activity);
      })
      .toList()
      .toJS()
      console.log(b);
      return activity.filter((activity:Map<string, any>) => {
        return this.shouldInclude(activity);
      })
      .toList()
      .toJS()
      .sort((a, b) => {
        return moment(a.startDate.iso) > moment(b.startDate.iso);
      })
    })

    this.activitiesSub$ = this.activities$.subscribe((x) => {
      this.zone.run(() => {
        console.log('Search Update');
      })
    });

  }
開發者ID:hack4change,項目名稱:hambasafe-client,代碼行數:26,代碼來源:activity-list.ts

示例5: ngOnInit

 ngOnInit() {
   // this.navCtrl.setRoot(HomePage);
   this.authStatus$ =  this.ngRedux.select(['currentUser', 'status'])
   this.authStatusSub$ = this.authStatus$.subscribe((userStatus) => {
     console.log('User Status');
     console.log(userStatus);
     switch(userStatus) {
       case 'AUTHENTICATED':
         console.log('AUTHENTICATED');
         if(!!this.loadingPopup){
         this.loadingPopup.dismiss();
       }
       this.navCtrl.setRoot(HomePage);
       this.ngRedux.dispatch(this.userActions.subscribeToUser());
         // this.navCtrl.setRoot(HomePage).catch(err=>{
         //   console.log(err);
         // });
       break;
       // case 'ATTEMPTING':
       //   break;
       case 'ERROR':
         if(!!this.loadingPopup){
         this.loadingPopup.dismiss();
       }
       break;
       default:
         console.log('Unhandled authentication status');
     }
   })
 }
開發者ID:hack4change,項目名稱:hambasafe-client,代碼行數:30,代碼來源:landing.ts

示例6: ngOnInit

 ngOnInit() {
   this.counter$ = this.ngRedux
     .select(n => n.counter.get('count'));
     
   this.ngRedux.mapDispatchToTarget(CounterActions)(this);
   
 }
開發者ID:e-schultz,項目名稱:angular2-redux-example,代碼行數:7,代碼來源:counter-page.ts

示例7: constructor

  constructor(
    private ngRedux: NgRedux<IAppState>,
    applicationRef: ApplicationRef,
    private sessionActions: SessionActions) {

    const session$: Observable<Map<string, any>>
      = ngRedux.select<Map<string, any>>('session');

    this.hasError$ = session$.map(s => !!s.get('hasError'));
    this.isLoading$ = session$.map(s => !!s.get('isLoading'));
    this.loggedIn$ = session$.map(s => !!s.get('token'));
    this.loggedOut$ = this.loggedIn$.map(loggedIn => !loggedIn);

    this.userName$ = session$.map(s => {
        return [
          s.getIn(['user', 'firstName'], ''),
          s.getIn(['user', 'lastName'], '')
         ].join(' ');
      });

    ngRedux.mapDispatchToTarget((dispatch) => {
      return {
        login: (credentials) => dispatch(
          this.sessionActions.loginUser(credentials)),
        logout: () => dispatch(
          this.sessionActions.logoutUser())
      };
    })(this);

    this.unsubscribe = ngRedux.subscribe(() => {
      applicationRef.tick();
    });
  }
開發者ID:lokeshjain2008,項目名稱:angular2-redux-starter,代碼行數:33,代碼來源:sample-app.ts

示例8: ngOnInit

 ngOnInit() {
   
   this.selector = this.ngRedux
     .select(state => state.session, is)
     .subscribe(n => { 
       this.session = n;
       this.isLoggedIn = n.get('token', false);
     });
 
   this.ngRedux.mapDispatchToTarget(this.mapDispatchToThis)(this);
   
 }
開發者ID:e-schultz,項目名稱:angular2-redux-example,代碼行數:12,代碼來源:sample-app.ts

示例9: ngOnInit

  ngOnInit() {
    
    let filterTodos = (val: boolean) => (item: Todo) => item.completed === val;

    this.hideCompleted$ = this.ngRedux.select(state => {
      
      return !state.filter.showCompleted;
    });

    this.todos$ = this.ngRedux
      .select(n => n.todos);

    this.completedTodos$ = this.todos$
      .map(todos => todos.filter(filterTodos(true)));

    this.incompleteTodos$ = this.todos$
      .map(todos => todos.filter(filterTodos(false)));

    this.total$ = this.todos$.pluck('length');
    this.completed$ = this.completedTodos$.pluck('length');

    this.filteredTodos$ = this.todos$
      .combineLatest(this.hideCompleted$, (todos, filter) => {
        return todos.filter(n => filterTodos(false)(n) || filter === false);
      });

    this.ngRedux.mapDispatchToTarget({
      completeTodo,
      editTodo,
      deleteTodo,
      filterCompleted,
      completeAll,
      clearCompleted,
      addTodo
    })(this);

  }
開發者ID:e-schultz,項目名稱:angular2-redux-example,代碼行數:37,代碼來源:todo-page.ts

示例10: constructor

    constructor(ngRedux: NgRedux<IAppState>) {
        ngRedux.select(n => n.dices.get('status'))
            .subscribe((status:any) => {

            switch (status) {
                case 'WIN':
                {
                    this.cssClass = 'win';
                    this.status = 'Awww.. You WIN! Type next DICE!';
                    break;
                }
                case 'LOST':
                {
                    this.cssClass = 'lost';
                    this.status = `Sorry, not this time.. You've lost $100. Don't give up! Try again!`;
                    break;
                }
                case 'WAITING':
                {
                    this.cssClass = 'info';
                    this.status = 'Waiting for draw results...';
                    break;
                }
                case 'MISSED':
                {
                    this.cssClass = 'info';
                    this.status = 'Latest round missed. Keep on gambling - select Your lucky DICE!';
                    break;
                }
                case 'SELECTED':
                {
                    this.cssClass = 'info';
                    this.status = 'Selected dice. Confirm Your type by pressing the BET button.';
                    break;
                }
                case 'WAITING_FOR_NEXT_ROUND': {
                    this.cssClass = 'info';
                    this.status = 'Waiting for the next round (maximum waiting time: 10s).';
                    break;
                }
                default:
                {
                    this.cssClass = '';
                    this.status = '';
                }
            }
        });
    }
開發者ID:asiam9,項目名稱:angularattack2016-dices-game,代碼行數:48,代碼來源:winloose-bar.ts


注:本文中的ng2-redux.NgRedux.select方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。