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


TypeScript basket.service.BasketService類代碼示例

本文整理匯總了TypeScript中@eg/share/catalog/basket.service.BasketService的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.BasketService類的具體用法?TypeScript service.BasketService怎麽用?TypeScript service.BasketService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: toggleBasketEntry

 toggleBasketEntry() {
     if (this.isRecordSelected) {
         return this.basket.addRecordIds([this.summary.id]);
     } else {
         return this.basket.removeRecordIds([this.summary.id]);
     }
 }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:7,代碼來源:record.component.ts

示例2: ngOnInit

    ngOnInit() {
        // A SearchContext provides all the data needed for browse.
        this.staffCat.createContext();

        // Cache the basket on page load.
        this.basket.getRecordIds();

        this.searchForm.searchTab = 'browse';
    }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:9,代碼來源:browse.component.ts

示例3: ngOnInit

    ngOnInit() {
        // Create the search context that will be used by all of my
        // child components.  After initial creation, the context is
        // reset and updated as needed to apply new search parameters.
        this.staffCat.createContext();

        // Cache the basket on page load.
        this.basket.getRecordIds();
    }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:9,代碼來源:catalog.component.ts

示例4: ngOnInit

    ngOnInit() {
        this.searchContext = this.staffCat.searchContext;
        this.summary.getHoldCount();
        this.isRecordSelected = this.basket.hasRecordId(this.summary.id);

        // Watch for basket changes caused by other components
        this.basketSub = this.basket.onChange.subscribe(() => {
            this.isRecordSelected = this.basket.hasRecordId(this.summary.id);
        });
    }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:10,代碼來源:record.component.ts

示例5:

 this.basketSub = this.basket.onChange.subscribe(() => {
     this.isRecordSelected = this.basket.hasRecordId(this.summary.id);
 });
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:3,代碼來源:record.component.ts

示例6: applyAction

    applyAction() {
        console.debug('Performing basket action', this.basketAction);

        switch (this.basketAction) {
            case 'view':
                // This does not propagate search params -- unclear if needed.
                this.router.navigate(['/staff/catalog/search'],
                    {queryParams: {showBasket: true}});
                break;

            case 'clear':
                this.basket.removeAllRecordIds();
                break;

            case 'hold':
                this.basket.getRecordIds().then(ids => {
                    this.router.navigate(['/staff/catalog/hold/T'],
                        {queryParams: {target: ids}});
                });
                break;

            case 'print':
                this.basket.getRecordIds().then(ids => {
                    this.net.request(
                        'open-ils.search',
                        'open-ils.search.biblio.record.print', ids
                    ).subscribe(
                        at_event => {
                            // check for event..
                            const html = at_event.template_output().data();
                            this.printer.print({
                                text: html,
                                printContext: 'default'
                            });
                        }
                    );
                });
                break;

            case 'email':
                this.basket.getRecordIds().then(ids => {
                    this.net.request(
                        'open-ils.search',
                        'open-ils.search.biblio.record.email',
                        this.auth.token(), ids
                    ).toPromise(); // fire-and-forget
                });
                break;

            case 'bucket':
                this.basket.getRecordIds().then(ids => {
                    this.addToBucketDialog.recordId = ids;
                    this.addToBucketDialog.open({size: 'lg'});
                });
                break;

        }

        // Resetting basketAction inside its onchange handler
        // prevents the new value from propagating to Angular
        // Reset after the current thread.
        setTimeout(() => this.basketAction = ''); // reset
    }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:63,代碼來源:basket-actions.component.ts

示例7: basketCount

 basketCount(): number {
     return this.basket.recordCount();
 }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:3,代碼來源:basket-actions.component.ts


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